Oliver Ekman-Larsson looked up in overtime and saw 15 seconds on the clock, but lost track after a couple of turnovers.
Knowing he had to hurry, Ekman-Larsson whipped a shot at the net, hoping it was in time.
It was, just barely, ending Arizona's team-record home losing streak in the process.
Ekman-Larsson scored with 0.3 seconds left in overtime, sending the Coyotes to a 2-1 win over the Edmonton Oilers that ended their nine-game home losing streak Tuesday night.
"When I saw (teammate Sam Gagner) get the puck in, I said, 'Yeah, let's try one more time,"' Ekman-Larsson said. "I got lucky there."
Arizona felt its way through the first period, dominated the second with a team-record 27 shots and sat back in third after Brandon McMillan scored his first goal of the season.
Devan Dubnyk kept the Coyotes in it during the down times, stopping 30 shots against his former team to help send the game to overtime.
With nearly everyone expecting a shootout, Ekman-Larsson provided a surprise ending, taking a feed from Gagner and beating Ben Scrivens just before the horn sounded.
Ekman-Larsson was swarmed by teammates after helping the Coyotes end a five-game losing streak overall. They earned a point for the 17th straight game against Edmonton, a franchise record against one team.
"We needed to get the win, obviously," Dubnyk said. "It was a must, but it was pretty crazy the way it ended."
The just-beat-the-clock ending left the Oilers frustrated in their first game since coach Dallas Eakins was fired on Monday.
Ryan Nugent-Hopkins scored in the first and Edmonton was able to rally after its shaky period — mostly because of Scrivens, who made 26 of his 42 saves in the second.
The Oilers controlled most of the third period and had some good chances in overtime, but couldn't get anything past Dubnyk and lost for the 16th time in 17 games.
"Heartbreaker, right?" interim coach Todd Nelson said. "There was 5 seconds left to play with the puck along the wall in front of our bench, then all of a sudden there's a rush and Larsson had a great shot."
Both teams were looking to gain a little traction in a season that has quickly spiraled downhill.
Edmonton entered last in the Western Conference with 19 points — matching Carolina for worst in the NHL — and fired Eakins on Monday after notching one win since Nov. 9. General manager Craig MacTavish was behind the bench with Nelson, promoted to interim coach from Oklahoma City of the AHL.
Arizona has been only marginally better, just ahead of Edmonton at the bottom of the West standings after one of the worst stretches in team history.
The Oilers jumped on the Coyotes early, scoring in the first period when Nugent-Hopkins sent a shot through the legs of Arizona defenceman Zbynek Michalek that beat Dubnyk stick side.
McMillan tied it midway through the second period, beating Scrivens from the right circle with a shot off the crossbar after Joe Vitale found him trailing the rush.
The Coyotes kept firing shots throughout the period, breaking their mark of 25 set against Calgary in 1982.
"We just got outworked in the period," Nugent-Hopkins said. "We can't have that."
Edmonton had just six shots in the period, but came out of it tied with Arizona thanks to Scrivens. He made some tough saves on Arizona's power play, a couple from in close, and denied Ekman-Larsson with a spectacular stop, stacking his pads for the block while lying on his side.
Then the Coyotes needed more than 13 minutes to get their first shot of the third.
Edmonton had 13 in the period, but couldn't get anything past Dubnyk, setting up Ekman-Larsson's game-winner.
"He's come up with some timely goals," Coyotes coach Dave Tippett said. "And today, very timely."
NOTES: Coyotes LW Lauri Korpikoski did not play due a lower-body injury, and D Michael Stone did not return after sustaining an upper-body injury on a big hit in the first period. ... Oilers LW David Perron played his 450th career game. ... Arizona C Shane Doan played career game No. 1,346, tying Mats Sundin for 47th on the NHL's all-time list.