Brad Stuart couldn't help but smile as he described his overtime goal off a shot from Joe Thornton that gave the Sharks a much-needed 3-2 win over the Calgary Flames on Tuesday.

"I didn't really do anything except let it go off me," Stuart said of his first goal of the season, which came 1:13 into the extra session. "I think it hit me in the elbow and popped down in between," Flames goalie Reto Berra's legs.

The aesthetics mattered little to the Sharks, who snapped a five-game losing streak and salvaged two points after nearly letting another victory slip through their hands. The Sharks continue their road trip in Vancouver on Thursday.

The Sharks had played some of their best defensive hockey of the season in the first 40 minutes, building a 2-0 lead on first-period goals by Logan Couture and Patrick Marleau and allowing just six Calgary shots on goal.

But that lead disappeared quickly in the third, as Kris Russell scored on the power play after Justin Braun was called for interference and Mike Cammalleri notched one at even strength for the Flames to tie the game 2-2.

Going into Tuesday, the Sharks were a combined 1-5 in overtimes and shootouts this season, including a 5-4 shootout loss to the Winnipeg Jets on Sunday in which they blew leads on two occasions.

But Stuart's goal helped end some of that frustration.

"You feel comfortable and then all of a sudden, then boom, boom, they're right back in the game," said Thornton, who also assisted on Marleau's goal. "We were still a confident group. We had been playing well all night, and coaches told us to stay with it. ... We did, and got the two points."

After lamenting the number of scoring opportunities they had given up in recent games, the Sharks made defense their first priority Tuesday. The Flames had 13 shots and starting goalie Alex Stalock was forced to make just 11 saves in getting his second career win.

Not only did the Sharks set a season record for fewest shots allowed in a game, they came within a whisker of setting a franchise record. They allowed 17 shots in a 2-1 loss to Boston on Oct. 24, and the team record for fewest shots allowed is 11 against Pittsburg in Oct. 2008.

Most importantly for the Sharks, they stayed a point back of Phoenix and moved to within four points of Pacific Division-leading Anaheim.

"It's been a long time since we felt like this," Sharks coach Todd McLellan said. "When you're on the bench and you're playing the kind of game that you are and in control. Then all of a sudden its 2-2, then you get to overtime and you wonder if you're going to a shootout and who's going to shoot. So it is a sense of relief."