Dan Boyle scored the tying goal early in the third period and Antti Niemi made 23 saves for the Sharks, who matched their season-opening, seven-game winning streak. San Jose remained perfect through six games of a seven-game homestand and has moved from ninth place to fourth in the Western Conference during this streak.
Mikael Backlund scored and Miikka Kiprusoff made 39 saves for the Flames, who have lost 12 straight road games.
The Flames are staggering to the finish having traded two of their top players before this week's deadline with captain Jarome Iginla going to Pittsburgh and defenseman Jay Bouwmeester being sent to St. Louis. But they still nearly ended the longest current winning streak in the NHL.
They took a 1-0 lead into the third period and even killed off an early power play before allowing the tying goal when no one picked up Boyle in the slot.
Logan Couture, who hit the crossbar earlier in the period, fed Boyle whose shot appeared to deflect off defenseman Dennis Wideman and into the net for his seventh goal of the season but just the second at even strength.
Joe Thornton nearly broke the tie for San Jose late in the period but was robbed by the crossbar. But Kiprusoff had no chance on Pavelski's game-winner. Kiprusoff stopped TJ Galiardi's original shot, but Brent Burns poked the rebound loose. Pavelski came from behind the net to knock the puck in to give the Sharks their third win this season when trailing after two periods.
The Sharks controlled the play for most of the first period but were still trailing 1-0 after 20 minutes because they couldn't get anything past Kiprusoff despite 17 shots.
Kiprusoff made a nice stop on Logan Couture early off a nice passing sequence from Tommy Wingels to Patrick Marleau, robbed Pavelski with a glove save and helped kill off an early power play.
The Flames then took just 6 seconds to score on their first man advantage when Couture was called for hooking. Backlund won a faceoff from Marleau back to Michael Cammalleri. Backlund took a return pass and beat Niemi with a shot from the top of the circle for the first power-play goal against San Jose in seven games.
Neither team scored in the second with both goalies turning aside eight shots and both teams failing to convert on a power play.
NOTES: Newly acquired Sharks Raffi Torres and Scott Hannan didn't play. Hannan is working his way back from a neck injury, and Torres didn't feel well but could play Sunday. ... San Jose D Jason Demers also could be back from a head injury on Sunday. ... Calgary D Mark Giordano didn't make the trip so he could be with his wife, who was due to give birth. Brett Carson played in his place for his first game of the season.