Vladimir Sobotka netted a hat trick, including two third-period goals that erased a 3-1 St. Louis deficit.
In overtime, Jackman worked the puck into the San Jose zone and found Berglin at the top of the crease, where he fed him a precise pass that Berglin tipped past Alex Stalock for the game-winner.
Jake Allen racked up 22 saves for St. Louis, which improved to 2-2-0 on its current five-game road trip.
Scott Gomez and Matt Irwin each notched a goal and an assist for the Sharks, who fell for the third time in five contests.
Stalock, making just his second NHL appearance, made six saves in relief of starter Antti Niemi, who was yanked in the third period after yielding three goals on 28 shots.