Jordan Stall gave the Hurricanes a 3-2 lead 6:55 into the third period, but Toronto then went on a surge that brought the Maple Leafs their third win in four games.
Dion Phaneuf tied it on a slap shot with 5:25 to play and Lupul's go-ahead goal came with 3:10 remaining.
Jay McClement and Nikolai Kulemin then added empty-net goals in the final minute.
The victory went to James Reimer, who made 19 saves. Justin Peters surrendered four goals on 34 shots. The Hurricanes have lost seven straight and heading into the evening's action were three points out of a playoff position.
Theater accidentally screens 'Nymphomaniac' trailer instead of Disney's 'Frozen'
18-year-old elf alleges mall Santa pinched her buttocks on the job