David Desharnais scored with less than two minutes to go in the first overtime frame for the win on Thursday night.
The fourth-line centre, in the slot, one-timed a Leon Draisaitl cross-ice pass past Sharks goaltender Martin Jones as the orange and blue-clad fans roared at Rogers Place.
“It feels amazing,” Desharnais, a trade-deadline pickup from Montreal, said in the Oilers locker-room afterward.
"Everybody was tired a little bit on the ice, so I just jumped in the hole, and (Draisaitl) made a really good pass and I just tried to shoot it as quick as I could and it went in."
The game was also a measure of redemption for Draisaitl, a top-10 NHL scorer this season who had been missing in action with no points prior to Thursday.
On top of that, he had been fined a day earlier for spearing Sharks centre Chris Tierney in the groin in Game 4.
Draisaitl also set up Mark Letestu late in the second period to cut the Sharks lead to 3-2.
"The first couple of games I hadn't been good, and tonight was a step in the right direction," said Draisaitl.
"I need to play like that. I'm expected to play like that."
The Oilers lead the Western Conference quarter-final series 3-2, with Game 6 Saturday night in San Jose. The series winner takes on the Anaheim Ducks in Round 2.
Patrick Maroon and Oscar Klefbom also scored for Edmonton. Mikkel Boedker, Patrick Marleau, and David Schlemko replied for San Jose.
"It feels unreal right now, especially how we won," said Klefbom.
"They came out to play, and so did we."
Boedker said it's a bottom-line game.
"It's always disappointing to lose. Losing sucks. There is no way around that," said Boedker.
"We battled hard tonight and did some good things to take that 3-1 lead, but unfortunately we couldn't battle it out."
The Oilers -- looking for a bounce-back game after an epic 7-0 beat-down by the Sharks in Game 4 -- dominated the first 10 minutes of the game.
Edmonton took a 1-0 lead at 5:28 when Maroon, standing at the edge of the crease, corralled a rebound off a Matt Benning shot to sweep the puck past Jones.
The Oilers also hit three goal posts -- two by Darnell Nurse and one by Jordan Eberle -- before San Jose responded at the midway point of the period.
Marcus Sorensen slap-passed the puck from the blue line to Chris Tierney, who then redirected the puck through the top of the crease to Boedker. Boedker then wristed the puck into an open net to complete the tic-tac-toe play.
The Sharks made it 2-1 with just over four minutes to go in the period. Taking advantage of a bad Oilers line change, Joe Thornton and Marleau broke in over the blue line on a two-on-one. Thornton's wrist shot leaked through Oilers goalie Cam Talbot and dribbled to the goal line, where Marleau stuffed it in.
The Sharks made it 3-1 just under nine minutes into the second period. A wrist shot by Schlemko from the blue line fluttered its way through a crowd in the crease and over Talbot's right shoulder.
The Oilers cut Sharks lead to one on the power play when Draisaitl backhanded the puck through a clutch of bodies in the slot to Letestu for a one-timer under the crossbar.
The Sharks smothered the Oilers attack for most of the third period until Klefbom blasted a shot from the blue line to tie the game with less than three minutes to play.
The Oilers dominated in overtime, outshooting San Jose 14-2, with Jones stoning Oilers captain Connor McDavid and Ryan Nugent-Hopkins from point-blank range before the Desharnais goal.