Hamilton scored at 17:41 of the third period, while Johnson turned aside a short-handed breakaway by Mikkel Boedker with just eight seconds left in the game.
“I think everybody was pretty shocked,” Johnson said of Boedker’s late scoring chance. “We’ve got a power play and all of a sudden, eight seconds left a guy’s on a breakaway from the blue line. You’ve kind of just try to stay focused and stay with him and thankfully nothing came of it.”
Want to stream all 82 Flames games this season? Sign up for Sportsnet NOW
Johnson also stuck out his left pad to stop Boedker from scoring on a penalty shot at 14:33 of the third.
"On the penalty shot, I just tried to stay with him," said Johnson, who made 25 saves to pick up his 15th win of the season. "I played with him in Phoenix, so I tried to go back in the memory log there and just try to remember what he did. He had two good looks there, but I got lucky and made the saves."
Hamilton and rookie forward Matthew Tkachuk both finished with a goal and an assist for the Flames (23-19-2), while Michael Frolik also scored. Mikael Backlund picked up a pair of assists.
"It's big," Hamilton said of beating the Pacific Division-leading Sharks. "I think for us, we've just go to try to win every game. Obviously right now it's tough to move up the standings, so we've got to do it now instead of trying to do it later in the season."
"Just losing makes it tough," said Burns, who scored once and set up two others in Edmonton on Tuesday to lead the Sharks to a 5-3 win over the Oilers. "You don't like to give away points. That's all that matters."
Making just his sixth start of the season, San Jose goalie Aaron Dell made 25 saves in a losing cause.
"It was pretty cool," said Dell, 27, who's from nearby Airdrie, Alta., and played two seasons for the Calgary Canucks of the Alberta Junior Hockey League from 2007-09. "I dreamed of playing here growing up. It was a dream come true. It could've been a little better."
Couture opened the scoring at 9:40 of the first period when he redirected a point shot fired by Burns through Johnson's legs for a power-play goal.
Frolik, who was in the penalty box serving a slashing penalty when Couture scored, then answered right back for the Flames at 11:22. Thanks to a nice second effort, Frolik shovelled a rebound past Dell to atone for his penalty.
Burns put the Sharks back up by one at 16:06 when his wrist shot from the point found the back of the net behind Johnson, who was screened on the play.
After being outshot 12-8 in the first period, the Flames turned the tables and outshot the Sharks 9-7 in the second.
The Flames were rewarded for their hard work during a man advantage when Tkachuk deflected Backlund's shot past Dell with 31.7 seconds left in the period.
Notes: Although he was listed as a scratch, defenceman Mirco Mueller started the game for the Sharks and even played a couple shifts before officials deemed him ineligible for the rest of the game. The Sharks had to then go with five defencemen, a group which included Tim Heed who was playing his first NHL game. â€¦ Calgary forward Sean Monahan has gone 11 games without scoring a goal. He has just four assists during that stretch.