Jordan Eberle scored two goals and Derek Roy and Justin Schultz one apiece for the Oilers (14-28-9), who ended the Sharks' three-game winning streak. Edmonton goaltender Viktor Fasth made 33 saves in regulation and overtime and stopped 12 of 13 shots in the shootout.
Schultz tied the game at 17:23 of the third period, helping extend the game after the Oilers blew a 3-1 lead.
"That was a good character win," Klinkhammer said after his first career shootout attempt. "We still have stuff to clean up. We shouldn't have let them back into the game. But we stuck with it and got the two points. We showed a lot of resiliency."
Brent Burns scored the first goal of the shootout in the fifth round for the Sharks, flipping the puck past Fasth into the top of the net, but Edmonton center Ryan Nugent-Hopkins answered with a goal.
Klinkhammer ended the game eight rounds later, beating Sharks goaltender Antti Niemi to his stick side.
"I was laughing the whole time," Klinkhammer said of the shootout. "I thought it was hilarious. And then I got the call and got lucky enough to get it into the net. I think we ran out of forwards so I had go. That was my first [shootout attempt] in the NHL, so I'm 1-for-1."
The 13-round shootout was the longest in history for each team. The Oilers had gone 12 rounds before and the Sharks 11.
Eberle, who's still searching for his first hat trick, had his third two-goal game of the season and 15th of his career.
The Sharks came into the game on the heels of impressive victories against the Los Angeles Kings, Anaheim Ducks and Chicago Blackhawks, three of the Western Conference's elite teams. But they continued their habit of losing to teams on the outside of the Stanley Cup Playoff race.
"It’s tough. I wish we could explain it," Sharks forward Logan Couture said. "If we all knew the reasons why, then it wouldn't happen. We fought back, we gave ourselves a chance for two points. (Niemi) played great in that shootout. We have to find a way to get one by him earlier in that shootout and we get two points and get an ugly win. We have to get better. We're facing a Calgary team in our next game [on Wednesday] that's going to be hungry and they're right behind us."
San Jose needed 10:32 to score three times in the third period on goals by Hannan, Tennyson and Pavelski to take a 4-3 lead.
Hannan scored his first goal of the season at 2:19 when he rushed the net, took a pass from Joe Thornton (three assists) and poked the puck past Fasth. Hannan ended a 72-game goalless streak, scoring for the first time since Nov. 23, 2013, against the New Jersey Devils.
Tennyson scored his second goal of the season at 3:49 when he took a pass from Tyler Kennedy in the high slot and beat Fasth with a slap shot.
Then at 10:32, Pavelski took a long pass from Burns and hammered a shot past Fasth from close range, sending the puck inside the left post to give San Jose a 4-3 lead. Burns had the primary assist, and Thornton had his 600th assist as a Shark.
"I thought we got outworked in the second period and probably out-emotioned," Sharks coach Todd McLellan said. "We were flat. We didn't have the [emotion] that it takes to win. It showed up in the third again when we were aggressive and assertive. We can't be all over the map. We had one line I thought tonight that played well, one line. We had too many passengers. It's what you get when you don't come and play as a full team."
The Oilers roared back to tie the game 4-4 at 17:23 on Schultz's wrist shot from the right circle.
Pavelski nearly scored from close range moments before the horn sounded, but Fasth made a brilliant pad save.
The Oilers played the third period without forwards Taylor Hall and Benoit Pouliot, who left the game because of injuries. Hall had returned to the lineup after missing three games with a bruised bone in his lower leg but re-aggravated the injury, interim coach Todd Nelson said; Pouliot took a puck off his foot.
"Right now we're going to get back to Edmonton and have our doctors look at them," Nelson said. "We'll go from there."
The Oilers had gone 0-13-2 in California before defeating the Sharks for their first win in the state since April 1, 2012.
San Jose salvaged a point and finished their seven-game homestand 4-1-2.
"We get 10 points out of 14, we'll take it," McLellan said. "We have to be pleased with that. The way we played in some of the games we have to be really happy with the performances. At the other end of the spectrum we're really disappointed. Our team has to find that medium where we don't get too high and we don't get too low. Even the high part we'll take. This low part is unacceptable."
Pavelski gave the Sharks a 1-0 lead at 11:50 of the first period with his 14th power-play goal of the season. He moved into a tie with Washington Capitals captain Alex Ovechkin for the most power-play goals in the NHL.
With Andrew Ference in the penalty box for hooking Barclay Goodrow, the Sharks needed seven seconds to score. Patrick Marleau sent a pass toward a wide-open Pavelski in the slot, and the puck bounced off his right skate and past Fasth.
Eberle answered with highlight-reel goal at 18:03 of the first. He took a cross ice-pass in the left circle from Hall, then maneuvered past Patrick Marleau and Burns before burying his shot.
The Sharks thought they moved back ahead with 39.8 seconds left in the opening period when Tomas Hertl sent a rebound past Fasth from close range, but the goal was waved off because of goaltender interference. Sharks center James Sheppard backed into Fasth at the top of the crease.
The Oilers moved ahead 22 seconds into the second period on Eberle's second goal of the game and third in two games. Schultz fired what looked like a harmless shot from the right circle, but Niemi couldn't hold onto the puck and Eberle swooped in to score easily from the slot to make it 2-1. The goal was his team-high 15th of the season.
Roy extended Edmonton's lead to 3-1 at 9:39 of the second period with his fifth goal of the season. Nail Yakupov fed a perfect pass to a wide-open Roy in the slot, where he beat Niemi with a slap shot.
"I thought we played a good 40 minutes and then we let them back in, in the third," Fasth said. "It was good for us to fight back after falling behind and get one back."