The goal came with 5:56 to go in regulation and completed a Hurricanes comeback that ended a three-game losing streak. Toronto had won three in a row and suffered only its second loss of the season.
Toronto goaltender Jonathan Bernier began the game on the bench, but had to come into the contest just 32 seconds deep in the first period when starter James Reimer was injured in a collision with teammate Josh Leivo.
With time running down in the third period Hainsey cleared the puck from his own end and it bounced off the end boards behind Bernier. It then hit one of Bernier's skates and hopped back into the net.
Joffrey Lupul and Leivo scored during the first 7 minutes to give Toronto a 2-0 lead. It was the first goal of Leivo's NHL career.
Bernier stopped 37 shots in relief while the win went to Cam Ward, who recorded 24 saves.
'SNL': 'Anchorman 2' cast, One Direction sing 'Afternoon Delight' [VIDEO]
Reindeer recovered after escaping from Santa during lighting ceremony