TORONTO — Keeping alive their slim playoff hopes alive, the Toronto Maple Leafs earned a 4-3 overtime victory over the Boston Bruins on Thursday night.

However, Toronto may have to continue without first-string goaltender Jonathan Bernier.

An MRI exam will be done Friday to determine the extent to what coach Randy Carlyle referred to as a lower-body injury.

“We should know more tomorrow afternoon,” Carlyle said.

Bernier left the game with a 3-2 lead in the third period. He was replaced by James Reimer, who let in the tying goal but made 10 saves in his 14:29 of playing time. He held the fort until center Nazem Kadri scored a power-play goal at 2:51 of overtime.

“Reims, that’s a tough situation for him to come into,” Maple Leafs defenseman Dion Phaneuf said. “He did a great job for us, he made some big saves, he was calm and really made some saves at big times, too. He was good in every minute that he played.”

While the Maple Leafs needed the win to stay in the playoff race, the Bruins (52-18-7) earned a point in their battle for first place in the Eastern Conference. Boston, which scored twice in the third period to erase a 3-1 deficit, holds an eight-point lead on the second-place Pittsburgh Penguins.

Bruins coach Claude Julien feels playing desperate teams is good preparation for the playoffs.

“That’s what we want to do from here on in,” Julien said. “We don’t want any easy games. I don’t think we need that right now. “

The victory gave the Maple Leafs (38-33-8) their second win in a row and a split in the four-game season series with the Bruins, who lost their second straight game overall.

Defenseman Paul Ranger, center Tyler Bozak and left winger James van Riemsdyk also scored for the Maple Leafs. Toronto right winger Phil Kessel added two assists.

Center Brad Marchand, left winger Milan Lucic and center Patrice Bergeron scored for the Bruins.

Chad Johnson made 27 saves in the Boston goal.

The Maple Leafs went on the power play at 1:52 of overtime when Boston defenseman Torey Krug took a holding penalty. That set up the 19th goal of the season by Kadri and a desperately needed win for Toronto.

“I thought in the second period we were able to carry more O-zone time and create opportunities, but weren’t able to capitalize,” Lucic said. “But finally we were able to capitalize in the third period to tie it up. It showed some character to be able to come back against a desperate team like Toronto. These are the kinds of situations in which you can find yourselves in the playoffs.”

The Bruins cut Toronto’s lead to one at 5:03 of the third period on the 22nd goal of the season by Lucic, who fired home a shot from the slot after a pass from center David Krejci.

At 8:22 of the third, Bernier, who made 25 saves, left with an undisclosed injury and was replaced by Reimer. At the same time, Ranger was sent off for interference to put Boston on a power play that the Leafs survived.

Bergeron scored his 28th goal of the season at 12:51 of the third on a 40-foot wrist shot off an assist from Marchand to tie the score at 3.

“I tried to hold the boys in there and give us a chance to win,” Reimer said. “Unfortunately I let one in, but we found a way. You don’t want to see a teammate and friend hurt. But (if called upon), I’m going to go out and try to give our team a chance to win.”

The Maple Leafs took a 3-1 lead at 52 seconds of the second period on the 30th goal of the season by van Riemsdyk from the low slot on a setup by Kessel.

The teams exchanged goals in a span of 56 seconds in the first period. Ranger stuffed home his fifth goal of the season from the slot on a rebound at 6:00.

The Bruins tied it at 6:56 when Marchand snapped home his 23rd goal of the season from the top of the right faceoff circle after a giveaway by defenseman Cody Franson.

The Maple Leafs took a 2-1 lead with 12 seconds left in the first period. Bozak knocked in a high puck at the right post for his career-best 18th goal of the season after a pass from the left corner by Kessel.

NOTES: The Maple Leafs recalled RW Carter Ashton from the Toronto Marlies of the AHL on Thursday, but he did not play. … Toronto LW Joffrey Lupul (lower-body injury) was out. … The Leafs signed 18-year-old C Carter Verhaeghe to a three-year, entry-level contract, and he will join the Marlies on an amateur tryout agreement. Verhaeghe was taken in the third round (82nd overall) in the 2013 draft. This season, he led the Ontario Hockey League’s Niagara IceDogs in assists (54) and points (82) and was third in goals (28) in 65 games. … C Carl Soderberg, who scored a goal on Wednesday in the Bruins’ 3-2 loss to the Detroit Red Wings, did not play Thursday so that he could be with his expectant wife. … Bruins D Andrej Meszaros was a healthy scratch. … The Leafs play their last regular-season home game on Saturday against the Winnipeg Jets before finishing their schedule with three road games. … The Bruins play host to the Philadelphia Flyers on Saturday.