Leading 1-0 after the first, Toronto went into overdrive in a second period that saw it build its lead to 2-0 while outshooting the Flames 13-4.
Calgary woke up in the third period — its 39 goals and plus-23 differential in the third led the league going into the game — and cut the margin to 2-1 less than four minutes in. The Flames outshot the Leafs 16-8 in the period, mounting a comeback that finally faltered with Jonas Hiller out for the extra attacker.
Through it all, Jonathan Bernier held firm in the Toronto goal with 32 saves.
"Bernier came up with big saves at the right time," Calgary coach Bob Hartley said. "We knew what to expect because he's been real hot in the last past games."
"I thought we played a decent first period, a great third period. But on the road against a team that is playing really well you need a full 60-minute effort."
"Our second period wasn't good enough," said Flames forward Matt Stajan.
Toronto coach Randy Carlyle understandably had a different view of the timeline.
"The second period was probably one of the best periods we've played this year," he said.
But it didn't stick. Carlyle said his team sat back in the third, stopped hitting and had to chase the action.
James van Riemsdyk scored the winner early in the second period, traditionally a fertile time for the Leafs. Toronto came into the game with a league-leading 39 goals in the second.
Peter Holland opened the scoring for Toronto, which got empty-net goals from Phil Kessel and Mike Santorelli. The Maple Leafs, who are now 12-0-0 when scoring first, wrapped up a five-game homestand at 4-1-0 before 19,122 at the Air Canada Centre.
Markus Granlund scored for the Flames, who played well in the first period but trailed 2-0 going into the third.
Calgary, which came into the game 9-0-1 after a loss, outshot Toronto 33-29.
The Leafs (15-9-3) are now 6-1-1 since a pair of lopsided losses to Buffalo and Nashville.
Asked if the 9-2 Nashville loss on Nov. 18 was a turning point, Carlyle said: "I knew it couldn't get much worse. It was bad.
"You get thumped 9-2 at home, it's not a lot of fun. I don't care what market you're in."
The Flames (17-10-2) were coming off a 3-2 loss to San Jose that snapped a four-game win streak.
Toronto got a sharp outing from Bernier in his career-high ninth straight start and 11th in 12 games. Bernier, who made 44 saves in Saturday's win over Vancouver, came into the game with a 3-1-0 career mark against Calgary with a 1.75 goals-against average and .944 save percentage.
A goal-saving stop by Bernier on Johnny Gaudreau in close midway through the first period turned into a goal at the other end when, on the ensuing rush, Joffrey Lupul beat a defender down the boards and sent the puck over to the net. David Clarkson's rebound went to Holland, who stuffed it in at 10:46 for his seventh of the season and second in as many games.
For the 26-year-old goalie, it was a welcome good night at the office. The soft-spoken Bernier made headlines after a recent Toronto Raptors' event marking the first anniversary of the death of Nelson Mandela when, appearing somewhat confused, he referred to the former South African president and human rights crusader as an tremendous athlete.
Bernier apologized later, saying he had got nervous and mixed up on the red carpet.
He was back in his element Tuesday.
"I'm feeling pretty confident, pretty comfortable out there," he said. "I think we have some pretty good chemistry with my D (defence) as well."
Carlyle said the Leafs have to be careful not to overplay Bernier, but that the recent schedule has allowed the goalie to have the proper rest between games. James Reimer may finally get to play Wednesday in Detroit.
Hiller, who had lost all four previous starts against the Leafs, was in the Flames goal after five consecutive starts by Karri Ramo.
The Leafs made it 2-0 on the power play at 2:51 of the second, after a heads-up play by Nazem Kadri. Rather than shooting himself from the face-off dot, the Toronto centre slid a perfect pass over to van Riemsdyk, who redirected the puck past Hiller from in front for his 11th of the season.
Dion Phaneuf got an assist on the play, the ex-Flames' first career point against Calgary in seven games.
Toronto outshot Calgary 6-0 in the first 8 1/2 minutes of the second period and were outshooting the visitors 11-1 some 11 minutes into the period.
The Leafs got sloppy as the second ended, with one sequence having two Toronto players without sticks after Stephane Robidas lost his and fumbled a stick handover from Clarkson.
Kessel showed great skill early in the third, knocking down a high pass from behind him and then flicking it to linemate Tyler Bozak whose shot was stopped by Hiller. The Swiss goalie then stopped Clarkson on a rush.
A penalty for too many men on the ice then cost the Leafs as Granlund beat his man and tucked a fine pass from Mark Giordano past Bernier to cut the lead to 2-1 at 3:48. It was his fourth goal of the season.
Follow @NeilMDavidson on Twitter