TORONTO (AP) — Curtis McElhinney was doing the usual work of a backup goalie at the end of the Toronto Maple Leafs’ bench midway through the second period. Moments later — and to almost everyone’s surprise — he was in the middle of the action.

“I’m sitting there (charting) faceoffs,” McElhinney said. “Next thing you know they’re handing my gloves to me.”

READ MORE: Dallas Police Officer Arrested For Domestic Assault

McElhinney stopped 13 of 15 shots in relief of injured starter Frederik Andersen — including a couple while his team was a killing a penalty in overtime — before Mitch Marner scored the winner in the shootout as Toronto extended its franchise-record home winning streak to 11 games with a 6-5 victory over the Dallas Stars on Wednesday night.

“The heart rate spikes,” McElhinney said of getting called on without any warning. “It certainly goes up and the adrenaline starts pumping. … Once the first shot’s taken you kind of settle in.”

Marner beat Kari Lehtonen in the third round of the shootout, completing Toronto’s comebacks from 4-2 and 5-4 deficits in the third period.

James van Riemsdyk had his third career hat trick, and Nazem Kadri and Patrick Marleau also scored in regulation for the Maple Leafs.

Andersen allowed three goals on 20 shots before leaving with an upper-body injury. He skated to the bench during a television timeout with 9:35 left in the second and headed straight to the locker room. There was no obvious sign he was hurt, but coach Mike Babcock didn’t seem overly concerned afterwards.

McElhinney came on and helped Toronto improve to 3-2-2 overall since star center Auston Matthews went down with a shoulder injury on Feb. 22. Tyler Bozak, who also scored in the shootout, and Marner each added two assists to keep the Maple Leafs perfect at home since losing to Colorado on Jan. 22.

Tyler Seguin had a goal and two assists, Jamie Benn added a goal and an assist, and Radek Faksa, Remi Elie and Brett Ritchie also scored in regulation for Dallas. Lehtonen made 26 stops through overtime.

“We came back and won the hockey game about three times, but we ran out of gas,” Dallas coach Ken Hitchcock said. “It’s tough. I felt for the players.”

After the Leafs stormed back with two goals in the third to tie it 4-4, Ritchie took a feed from Seguin and beat McElhinney with 6:42 remaining for his sixth goal of the season.

However, Marleau tied it with 15.3 seconds left in regulation when he tipped home Marner’s shot for his 22nd to send the game to overtime.

READ MORE: Much Happening In DFW For Juneteenth Including Walk With Opal Lee

Trailing by two after jumping out to an early 2-0 lead, the Maple Leafs pulled to 4-3 at 5:13 of the third when van Riemsdyk softly flipped his second of the night into the roof of Lehtonen’s net.

Toronto got the game’s first power play with about 10 minutes left in regulation, and van Riemsdyk scored his third goal of the night, and team-leading 29th of the season, at 10:43 off a hard pass from Marner.

Van Riemsdyk’s three goals moved him past Matthews, who missed his 17th game of the season due to injury, for the team lead.

Trailing 2-0, the Stars got on the board with the teams playing 4-on-4 with 5 1/2 minutes left in the first when Seguin beat Leafs defenseman Morgan Rielly to a puck in the corner off a faceoff and fed Benn, who got his 25th.

Dallas tied it 1:32 later when Greg Pateryn blasted a shot from the point that ticked off Faksa in front for his 14th.

The Stars came out flying to start the second — outshooting Toronto 9-1 — before Seguin gave his team its first lead at 4:30 for with his 37th.

Andersen left the crease during a television timeout with 9:35 left in the second and went straight to the locker room.

Dallas pushed its lead to 4-2 at with just under six minutes left in the middle period when Elie scored his sixth off a nice no-look feed from Devin Shore.

While the Maple Leafs are all but assured of finishing as the No. 3 seed in the Atlantic Division with the playoffs less than a month away, the Stars find themselves in a battle for a postseason spot in the tight Western Conference standings.

Toronto opened the scoring at 4:28 of the first when Kadri took advantage of Lehtonen’s miscue in front to tap home his 27th.

The crowd at Air Canada Centre barely had a chance to get back in their seats before van Riemsdyk made it 2-0 just 25 seconds later when he banged in a rebound — also his 27th — off a scramble in front.

MORE NEWS: Drowning In Grapevine Lake Prompts Warning From First Responders

(© Copyright 2018 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)