BOSTON -- The Boston Bruins turned back Toronto's comeback with a rally of their own.
Trailing by three goals in the third period and still by two with less than 90 seconds left in their season, the Bruins scored twice in a span of 31 seconds to tie it and then eliminated the Maple Leafs on Patrice Bergeron's goal at 6:05 of overtime to win 5-4 in Game 7 on Monday night.
"It was one of the crazy ones I've been part of," said Bergeron, who assisted on Milan Lucic's goal with 1:22 in regulation and scored to tie it with 51 seconds left in the third. "We found a way, not necessarily the way we would have liked to play the whole game."
Tuukka Rask stopped 24 shots for Boston, which led the best-of-seven series 3-1 before the Maple Leafs won two in a row to force a seventh game.
According to the Elias Sports Bureau, the Bruins are the first team in NHL history to win a Game 7 after trailing by three goals in the third period.
The Bruins will play the New York Rangers in the Eastern Conference semifinals, starting the series at home; the NHL has not announced the dates.
Toronto opened a 4-1 lead in the third period of the decisive game, but Nathan Horton cut the deficit to two midway through the third period and then Lucic and Bergeron scored in the final 1:22 with Rask on the bench for an extra skater.
"Anything can happen," Lucic said, "and that's exactly what happened."
Cody Franson scored twice, and former Bruin Phil Kessel had a goal and an assist for Toronto.
But it was the one he missed that left him sprawled in the crease, face down, while the Bruins celebrated.
"I was trying to be pretty even-keeled," said Reimer, who was teary-eyed in the locker room after the game. "There was time left, they could come back and they did. When you're up 4-1 you'd like to be able to hold onto that lead."
Toronto hadn't been to the playoffs since 2004, but some of the players had: forward James van Riemsdyk was on the Philadelphia team that rallied from a 3-0 deficit to eliminate the Bruins in the 2010 Eastern Conference semifinals.
This time the comeback fell short.
"It's tough to stay composed," Franson said. "Any type of playoff experience will help us [next year]. But unfortunately we've got to live through this the whole summer. Anytime you get knocked out of the playoffs, it hurts."
The win completed a whipsaw of a weekend for Boston, which won Games 3 and 4 in Toronto last week to put the Maple Leafs on the brink of elimination, but failed to clinch at home on Friday and again in Game 6 when the series returned to the Air Canada Centre.
The Bruins found out during the game that their plane had mechanical difficulties, so they returned to their Toronto hotel and flew back to Boston on Monday morning, just hours before the game.
"They had us on the ropes and we're glad we're done with them," Bruins coach Claude Julien said. "Drained is obviously the key word. The emotions of this game had us going in all directions."
The Bruins appeared tired in the early part of the game, spotting Toronto a 4-1 lead on Nazem Kadri's goal at 5:29 of the third period.
But Bergeron flicked one in with 51 seconds left, then ended it when he picked up a rebound to Reimer's left and put it over the sprawling goaltender to send his teammates pouring over the boards and the crowd into a frenzy.
Or, at least, those who stayed: Hundreds if not more had left in the third period, then begged security to get back into the TD Garden after the Bruins rallied.
Bergeron, who had only one goal in the first six games, had two goals and his first assist of the playoffs. Lucic had a goal -- his second -- and an assist, and Tyler Seguin had an assist for his first point of the postseason.
The Bruins took a 1-0 lead 5:39 into the game when Franson, against the boards in his own zone, flicked the puck back between his legs right to Matt Bartkowski.
But the Maple Leafs defenseman made up for it when he tied the score four minutes later, backhanding a loose puck into the net off a rebound.
Franson gave Toronto the lead at 5:48 of the second when, then Kessel made it 3-1 two minutes into the third when he tapped in a rebound in the crease.
The announcement of Kessel's name brought a chorus of boos from the Boston fans, who feel he never reached his potential after the Bruins picked him fifth overall in the 2006 draft.
But mostly the fans booed their own team before turning around late with chants of "Let's Go Bruins!" and "U.S.A.!"