The Toronto Maple Leafs appeared to be sitting pretty.

Sure, they'd lost starting netminder Frederik Andersen to injury, but after a dominant 40 minutes and a goal that put them up 3-1 on Florida early in the third period, that was something to worry about following the final buzzer.

Moments later, however, the Panthers were back on even terms. And not long after that the visitors were walking out of Scotiabank Arena with two valuable points in the Atlantic Division playoff race.

Mike Hoffman scored the winner and defenceman-turned-forward Mark Pysyk bagged his first-career hat trick as Florida rallied back from a two-goal, three-period deficit to stun Toronto 5-3 on Monday night.

Concern over Andersen

Andersen stopped seven of eight shots in the opening period, but was forced into concussion protocol after getting bumped into at least three times — with the worst coming on a collision with Panthers centre Frank Vatrano about five minutes before the intermission.

Keefe said his No. 1 goalie passed concussion protocol, but didn't know if he would practice Tuesday before the Leafs fly to New York for a meeting with the Rangers on Wednesday. The Leafs' busy week also includes a home game against Anaheim on Friday and a visit to Montreal on Saturday.

Toronto has recalled netminder Kasimir Kaskisuo from the Toronto Marlies of the American Hockey League. Kaskisuo made his first career NHL start in November when he allowed six goals in a loss to the Pittsburgh Penguins.

The native of Finland is 12-7-2 with a 2.67 goals-against average and .912 save percentage this season for the AHL's Toronto Marlies.

Andersen was replaced in Monday's game by backup Michael Hutchinson, who allowed three goals on 13 shots.

"[Andersen's] a big part of this team, obviously, but when he goes down, we've got faith in Hutch," Matthews said. "We just didn't play well in front of him for the last 20 minutes."

Hoffman also set up Jonathan Huberdeau's game-tying goal for Florida (29-17-5), which got 31 saves from Sergei Bobrovsky and moved past Toronto into third in the Atlantic on 63 points. Mike Matheson had three assists for the Panthers, who have two games in hand on the Leafs (63 points).

WATCH | Leafs concede 4 unanswered goals in home loss:

Florida scores 4 goals in the final period to beat Toronto 5-3, Frederik Andersen leaves game with injury. 1:47

"The result sucks," Leafs head coach Sheldon Keefe said. "I don't think the result is in any way indicative of the way the game went. When you talk about the maturity of our team, a lot of the narrative is how we can't defend. That's the best defensive game we've played the entire season. I don't know if we gave up over four scoring chances at even-strength.

"[We] just got distracted by the 3-1 goal and perhaps that's an area we'd like to have back and do better job of. There's a lot of things to like about what we did."

Frederik Andersen was run into in the first period on this chance and did not come out for the Maple Leafs for the start of the second 😬 <a href="https://t.co/I6Xm88MOMM">pic.twitter.com/I6Xm88MOMM</a> —@FanSidedNHL

'We got sloppy early in the third'

Auston Matthews, with his 37th goal of the season, William Nylander and John Tavares replied for Toronto (28-18-7), which tumbled down to 10th in the Eastern Conference and saw its three-game winning streak come to an end. Mitch Marner chipped in with two assists.

"Obviously disappointing," Tavares said. "It's not going to be a good feeling leaving the rink ... we got sloppy early in the third.

"There's a lot of hockey left so we just have to turn the page."

After Matthews gave Toronto that 3-1 advantage 38 seconds into the third, Florida responded with two goals in under a minute before Hoffman banked his 19th off Leafs defenceman Cody Ceci and through Hutchinson's pads at 10:30 to make it 4-3.

"It's just one of those series of unfortunate events that ends up in the back of your net," Hutchinson said.

Unlikely (hat trick) hero

Florida, which embarrassed Toronto 8-4 in Sunrise on Jan. 12, held on from there as home side offered little in the way of pushback before Pysyk completed the hat trick into an empty net to help his team to move back into a playoff spot.

"I got lucky at the end there," said Pysyk, 28, who guesses Monday was his first three-goal game since he was 10 or 11 years old. "Breakaway, open net. I thought I was going to miss it ... I was a little nervous."

The Panthers were without star centre Aleksander Barkov (lower-body injury) after he was hurt in Saturday's 4-0 loss at Montreal in their first game back following the all-star break and bye week.

Leafs recoup two

Leafs defenceman Travis Dermott (illness) returned to the lineup after missing Saturday's 2-1 overtime win against Ottawa, while winger Kasperi Kapanen was also back following a one-game banishment to the press box for being late to Friday's practice.

Toronto went up 3-1 early in the third when Matthews connected after Zach Hyman shovelled a pass towards the Florida net. Matthews now sits tied with Washington's Alex Ovechkin (37) for second in the overall goal race, and is one back of Boston's David Pastrnak (38).

But Pysyk got the visitors back within one at 2:20, burying his sixth on a rebound. Marner then went to the box and Florida tied it just seven seconds later at 3:18 when Huberdeau redirected a Hoffman pass for his 19th.

Matthews hit the post on another Leafs power play with Bobrovsky at his mercy before the Florida goalie also blocked a follow-up one-timer from the star centre to set the table for Hoffman's winner.

All smiles after this Mike Hoffman (<a href="https://twitter.com/MHoffy68?ref_src=twsrc%5Etfw">@MHoffy68</a>) goal. 😁 <a href="https://t.co/onfbjvhbBA">pic.twitter.com/onfbjvhbBA</a> —@NHL

Down 1-0 and minus their starting netminder, the Leafs tied things on the power play at 3:21 of the second when Tavares chunked a shot from the slot past Bobrovsky for his 19th, and first in five games.

Nylander gave his team its first lead with 54.8 seconds remaining in the period just as another Florida penalty expired, redirecting a slick feed from Kapanen for his 25th.

Toronto had a number of opportunities to jump in front early — the Leafs led 10-0 on the shot clock more than halfway through first — but Bobrovsky was there every time before Pysyk put Florida in front.

Matheson moved down from his point position below the goal line and fed Pysyk, who found a soft spot between two defenders, to fire his fifth upstairs on Andersen on Florida's second shot.

"We played a really good game," Keefe said. "If we play that type of game 100 times, we probably win 99 of them."