The Toronto Maple Leafs won a Thursday-night thriller at Scotiabank Arena, beating the New York Rangers 5-4 on Troy Stecher’s goal with 26.3 seconds left in regulation. On a delayed penalty, Stecher took a pass from Morgan Rielly and shot over Dylan Garand’s glove from the top of the right face-off circle — his first goal of the season, in his 11th game.

It was the last turn in a game that swung all night. Easton Cowan opened the scoring on a breakaway, Mika Zibanejad tied it, and Teddy Blueger restored Toronto’s lead before Oliver Bjorkstrand and Tye Kartye put New York ahead 3-2 in the second period. Brandon Duhaime — who finished with a goal and two assists — tied it again, and Kirill Marchenko’s power-play goal sent Toronto into the third period up 4-3.

Alexis Lafreniere tied it 4-4 at 14:25 of the third, setting up Stecher’s winner. Adam Fox had four assists for the Rangers (7-4-1), and Garand made 30 saves. Sergei Bobrovsky stopped 21 shots for Toronto (6-4-2), and his 459th NHL win tied Henrik Lundqvist for the most by a non-North American goaltender.

Up next, the Rangers visit Ottawa on Saturday night, while the Maple Leafs travel to Edmonton the same night looking for a fourth straight win.