The 17 goals were the most in an NHL game since the Winnipeg Jets defeated the Philadelphia Flyers 9-8 on Oct. 27, 2011.
"I don't know if I can even put that into words," said Maple Leafs forward Auston Matthews, who scored a goal with three assists. "I've never played in a game like that."
Toronto led 7-2 after two periods, but Detroit got within 7-6 and 8-7 in the third period.
"That was exciting for the fans, but it is fool's gold for a coach, because what happened out there wasn't good enough," Red Wings coach Jeff Blashill said. "It wasn't close to being good enough."
The Red Wings tied their record with seven goals in a loss. They did it five times previously, most recently on Feb. 24, 1993, 10-7 to the Buffalo Sabres.
"I've never been a part of anything like that," said Red Wings defenseman Marc Staal, who played his 994th NHL game. "It was crazy to score all those goals and be back in a game where we had been that bad for two periods."
Toronto (34-14-4) won its second straight game after losing three in a row. Jack Campbell allowed five goals on 25 shots before being replaced in the third period by Petr Mrazek, who made six saves.
"The craziness of the third period is going to be the focus of the night, but our guys deserve some attention for playing a really good game," Maple Leafs coach Sheldon Keefe said. "In a game like that, you are just looking to get out of there in the third period, and things changed in a hurry."
Filip Hronek had a goal and three assists for Detroit (23-24-6), which lost for the third time in four games. Alex Nedeljkovic allowed three goals on 13 shots in 11:06 before being replaced by Thomas Greiss, who allowed four goals on 14 shots. Nedeljkovic returned for the third period.
"We got down 3-0 right off the bat, so I made a change to try to get something going," Blashill said. "When [Greiss] gives up four more, I decided to go back to [Nedeljkovic] because he hasn't played much recently because of the schedule."