TORONTO — Michael Grabner, who came to the Rangers as a free agent, burned his former team Thursday night. He rescued the Rangers with a shorthanded goal with five minutes left and added an empty-netter as the Blueshirts snapped a three-game losing streak with a 5-2 win over the Maple Leafs at Air Canada Centre.

With the Rangers clinging to a 3-2 lead, Grabner took a pass from Kevin Hayes and beat Frederick Andersen on his glove side with 5:03 left. He iced the victory with an empty-netter, his team-leading 21st goal, with 2:55 remaining.

The Rangers dearly needed their 16th road win — the most in the NHL — on a night when there was no cave-in, no flurry of opposing goals and a solid effort from Henrik Lundqvist, who had allowed 16 goals on 77 shots entering the game in one of the worst stretches of his career.

But Lundqvist stopped 23 shots, and for the most part, his teammates were quicker to pucks, shooting from angles and anticipating plays. There were few of the long stretch passes that had become the Rangers’ trademark. Instead, there were quick decisions, short passes and return passes.

“Sometimes a win means a little bit more,” Lundqvist said. “You enjoy it a little extra after what I’ve been through the last week or so. Today it was better. I felt like I was more on my toes. We all felt like that this was our type of game, the way we need to play to have success. We didn’t give up as much, and it shows how committed we need to be in our own end.”

The defensive lapses weren’t completely erased. With the Rangers leading 3-1 near the end of the second period and on a power play, Adam Clendening turned the game into a nail-biter with a blunder in the defensive zone. Rather than moving the puck quickly, he allowed Zach Hyman to steal it, and Hyman’s unassisted goal drew the Leafs within 3-2 at 16:02.

advertisement | advertise on newsday

The Rangers’ special teams had almost cost them moments earlier. With Frank Corrado in the box for hooking, Lundqvist had to stop a five-hole, shorthanded attempt by Leo Komarov 19 seconds later. “That one on Komarov, when he closed up his legs for the save, that’s a changer right there. You love to see that,” Dan Girardi said.

In the third, the Rangers were content to chip away at the clock, forcing icings and clearing, which was a far cry from an aggressive first.

In a solid opening period, the Rangers fired 19 shots on Andersen, who had stopped 34 of 36 six days ago at the Garden, and scored twice. Lundqvist turned away eight of nine.

Mats Zuccarello, who had the puck deep, was patient and slid it out to Brady Skjei near the blue line, and his low, glove-side wrister beat Andersen cleanly at 6:42 for his second of the season. Skjei also had an assist.

Lundqvist was fired up from start to finish, yapping at former Islander Matt Martin for what he thought was a dive in the corner in the waning minutes. It was called a trip by Oscar Lindberg. Martin skated over, yelling back, but Grabner had made the response that counted.

Said Girardi: “We know everyone’s winning in our conference, and a three-game slide is not great to have. Hopefully, it’s a statement game for us and we can build off that.”