Christian Fischer and Jeff Petry each had two assists, and Ville Husso made 21 saves for the Red Wings, who finished the preseason 5-2-1.
Max Ellis and Thomas Miller each had a goal and an assist, and Joseph Woll made 28 saves for the Maple Leafs, who went 4-2-2. Kyle Clifford had two assists.
Detroit scored three times in a 2:27 span to take the lead.
Dylan Larkin cut it to 2-1 at 17:26 of the second by poking in a rebound.
Ben Chiarot tied it 2-2 at 19:04 with a one-timer from the point, and Joe Veleno put the Red Wings ahead 3-2 at 19:53 on a rebound from low in the right face-off circle.
Daniel Sprong scored six seconds after a power play expired to push it to 4-2 at 5:09 of the third period.
Sam Lafferty cut it to 4-3 at 17:48, scoring a power-play goal with Woll pulled for the extra attacker.
Ellis had given Toronto a 1-0 lead at 7:05 of the second, and Miller made it 2-0 at 10:41 with a wrist shot through traffic.