On the fourth chance for the Leafs, Hagman slid a backhander through Martin Brodeur's pads while facing center ice. Jamie Langenbrunner had the next opportunity to keep the game going for New Jersey but shot right into the blocker of Vesa Toskala.
Matt Stajan had two goals and an assist for the Maple Leafs, who have won three of four. Alex Steen, Alexei Ponikarovsky and Jamal Mayers also lit the lamp and Toskala stopped 26 shots in regulation for the win.
David Clarkson, Dainius Zubrus, Colin White, Zach Parise and Langenbrunner scored once each for the Devils, who have dropped three in a row.
Brodeur took the loss despite a 43-save performance.
The Devils took a 1-0 lead 2:32 into the contest, as Mike Mottau's shot from the bottom of the right circle was tipped out of the air by Clarkson.
It was 2-0 at 7:04 as Zubrus got credit for slamming the puck through traffic in the crease and into the net.
Toronto's three-goal burst in a little more than three minutes gave the visitors a lead early in the second period.
Stajan controlled a dump-in from the right boards and slid a shot by Brodeur at 4:13 to bring Toronto within a goal. Another Leafs power-play tally knotted the game at 5:31, as Tomas Kaberle's right-point floater sailed through a screen, hit Stajan and bounced in.
The Leafs went up by one with another power-play goal at 7:31. John Mitchell shot from the outer edge of the right circle and the puck hit Steen in the slot and changed direction.
Langenbrunner netted the equalizer 1:43 later, and White blasted one cleanly past Toskala with 6:18 remaining for a 4-3 Devils edge.
Toronto notched a pair of goals in a 70 second span midway through the third by Mayers (even strength) and Ponikarovsky (power play) to go up 5-4, but Parise's tally 52 seconds later forged a tie.
Neither side had any good chances to win in overtime despite New Jersey's 6-0 shot advantage.