He had made 27 saves before turning in the best one of his night.

With one second left in overtime, Kevin Hayes feathered a perfect pass to Rangers leading scorer J.T. Miller, and with the pressure of a seemingly unstoppable skid for his team weighing heavily on his shoulders, Canadiens goaltender Carey Price pushed off his right leg, dove across to his left and scrambled to get his arm on a puck destined for the back of his net.

There was nothing pretty about the save he ended up making. It was pure desperation. It ended up being a play that perfectly encapsulated the type of effort the Canadiens put into beating the Rangers — a team that had won seven of eight games coming in — by a score of 3-2.

The Canadiens, who had come to Madison Square Garden as the NHL’s most fragile team for the better part of a month, weren’t expected to win convincingly. They were barely expected to win at all, especially after the performance they turned in at the Bell Centre on Saturday.

Flashing back to the weekend, Montreal was rusty coming out of the bye week and completely disconnected in Claude Julien’s return behind the bench. The combination of those two factors produced an ugly 3-1 loss to the Winnipeg Jets that could’ve been considerably uglier had it not been for Price.

The Canadiens, backstopped by the same resolved Price, fought tooth and nail in New York to stay two points ahead of the Ottawa Senators — who collected a win in New Jersey on Tuesday — and took a giant step in the right direction.

Andrew Shaw gave them an early 1-0 lead after his teammates had strung together consecutive shifts of offensive zone pressure. But miscommunication between Canadiens defencemen Alexei Emelin and Shea Weber allowed Rangers forward Oscar Lindberg to tap one in from Price’s doorstep just over six minutes later.

Weber made up for it with a power-play blast — his 14th goal of the season — within two minutes of the start of the second period. But when Canadiens defenceman Andrei Markov got caught on an offensive-zone pinch, his partner Jeff Petry got stuck fighting off a breakaway opportunity for Rick Nash.

It didn’t go Petry’s way, and just like that the game was tied again.

Nash’s goal could’ve taken the air out of the Canadiens’ balloon. It came off the type of mistake that had been all too present in their game over recent weeks.

But Montreal’s effort didn’t wane after that point.

They killed off three penalties, they registered as many shots as the Rangers did until the end of the game, and they wound up taking an edge in hits, blocked shots and faceoffs by the end of it.

It’s those little things that lead to wins, and a big one was how the Canadiens limited their giveaways to just four against the Rangers. That was an integral part of the plan after committing 18 against the Jets, which was something Julien spent the better part of two practices on consecutive days between games trying to correct.

There were other signs of Julien’s influence amidst a few glaring errors covered by Price. The Canadiens stayed bunched together all three zones, they played aggressively on the forecheck, and they took away the middle of the ice in their own zone.

There was a chance it wasn’t going to be enough. It certainly wouldn’t have been had it not been for Price digging deep on that last-second chance from Miller.

And then came the shootout.

After Mats Zuccarello opened by freezing Price before scoring through the keeper’s legs, Alexander Radulov evened things up with a precisely placed backhand as Montreal’s second shooter.

Then Price came up with huge saves on Derek Stepan, Jimmy Vesey and Mika Zibanejad before Paul Byron faked backhand and finished forehand through Rangers goaltender Henrik Lundqvist’s legs to win the game.

“I like the way we battled,” Julien told reporters on scene. “I liked our work ethic, and I thought we skated well.”

But Julien had his biggest leader to thank for his first win in his second stint as Canadiens coach.

“He was the Carey we know well,” he said of the goaltender who had recorded his 258th NHL win to join legend Ken Dryden in third place in franchise history.

“He’s been solid in my two games with the team, and tonight he played like a goalie who gives your team a chance to win,” Julien added.

If Price and the Canadiens come up with a similar effort when they host the New York Islanders on Thursday, they’ll give Julien a chance at a win in his 1000th game as an NHL coach.