The victory was the Maple Leafs' (30-10-3) sixth in a row and handed the Hurricanes (31-10-2) only their second loss in nine outings.
Marner slammed in a rebound with 2:09 remaining in the extra period. But the celebration was tempered because of a scary incident for Auston Matthews.
With less than a minute remaining in regulation time, Matthews got tangled up with Carolina forward Nino Niederreiter and crashed into the end boards.
Matthews held his head after the incident and went to the dressing room to be examined.
After Matthews scored his 30th and 31st goals to give Toronto a 2-1 lead late in the second period, the Hurricanes scored twice in the first half of the third period to take the lead.
Carolina went ahead midway through the third period when an unmarked Derek Stepan knocked in a rebound at the side of the net.
But Marner scored for the eighth consecutive game after Andersen misplayed a point shot from Timothy Liljegren, leaving a juicy rebound for the Leafs' forward to tie the game with 5:48 remaining in regulation time.
This was the Hurricanes' first visit to Scotiabank Arena since the emergency backup David Ayres, a local Zamboni driver, defeated the Maple Leafs 6-3 on Feb. 22, 2020.
Andersen was the losing goaltender in the embarrassing defeat for Toronto.
After a slow start, the Hurricanes dominated the final 10 minutes of the first period. Niederreiter redirected a pass from defenceman Ian Cole to give Carolina a 1-0 advantage at the 13:06 mark.
Andersen made a handful of good stops, including a left pad save on Matthews on a three-on-two rush on the power play, to frustrate his old teammates.
The Maple Leafs finally beat Andersen on their third power play situation. Matthews poked in a loose puck in the crease for a 1-1 tie.
Toronto entered the game with the league's most efficient power play. Conversely, the Hurricanes are the top-ranked penalty killers.
Carolina had its chances to retake the lead. But Seth Jarvis fanned on a chance in front, and Mrazek stopped Sebastian Aho on a breakaway.
Matthews put Toronto in front 3:21 later, in the final minute of the second period, on a 37-foot blast from the high slot.
But the Hurricanes tied the game 2-2 eight seconds into the third period when defenceman Tony DeAngelo raced past Toronto defender Morgan Rielly and fired a wrist shot on the stick side of Mrazek.