Matthew Lombardi scored for the Flames, who lost for the sixth time in their last nine road games. Calgary, playing for the first time since its game Thursday night in Denver was postponed because of a blizzard, was 2-3 on a five-game trip.
Calgary plays seven of its next eight games at home, beginning Tuesday night against Vancouver.
The Sharks beat Calgary for the second time this season - handing the Flames one of their three home losses - after losing three in a row to the Western Conference rival.
Trailing 1-0, the Sharks scored four straight goals to get their fifth win in seven games.
Goc started the San Jose scoring, tying the score with 13:01 left in the second period.
Michalek took advantage of a lucky bounce on a power play to give San Jose a 2-1 lead four minutes later. Matt Carle took a shot from the top of the left faceoff circle, and the puck dribbled behind Flames goalie Mikka Kiprusoff, who fell trying to save it. Michalek poked it in from the right post for an easy goal.
Smith picked off Kiprusoff's clearing pass to Andrew Ference and slapped in an easy goal three minutes into the third period to make it 3-1. Kiprusoff stopped Curtis Brown's shot and failed to see Smith lurking behind Ference.
Hannan capped the scoring with an empty-netter in the final minute.
Lombardi gave the Flames a 1-0 lead with a short-handed goal with 2:05 remaining in the first period. Kristian Huselius picked up a loose puck and got it Ference, who flipped it up the ice to a streaking Lombardi, who easily beat Nabokov.
Notes: Smith and his band, Talking Trees, release their debut album next month. ... Calgary scored its seventh short-handed goal; only Montreal, Detroit and Pittsburgh have more. ... The Sharks have scored at least one power-play goal in 10 of their last 12 games. ... The Flames lost for the first time in 14 contests when leading after the first period.