CALGARY -- Nazem Kadri had a goal and an assist to help the Calgary Flames to a 3-2 win against the San Jose Sharks at Scotiabank Saddledome on Sunday.

Joel Hanley and Kevin Rooney scored for the Flames (27-21-8), who had lost three straight and four of five. Dustin Wolf made 27 saves.

"Found a way. ... Found a way," Kadri said. "That was really what it was all about today. I don't think it was our best game at all. I think the execution was a little bit sloppy, but we found a way and dug in."

Tyler Toffoli had a goal and an assist, and Macklin Celebrini scored for the Sharks (15-36-7), who have lost five in a row and 11 of their past 12 games. Alexandar Georgiev made 33 saves.

"It (stinks)," Toffoli said. "If anyone says they're having a good time losing games then I don't want them on my team, to be honest. It's one of those things where we just have to keep working and keep trying to find a way to battle and we need to get some wins."

Hanley put Calgary ahead 3-2 at 13:28 of the third period, scoring with a shot past Georgiev's blocker from the low slot during a 4-on-4. It was his first goal this season and his first game-winning goal in the NHL.

"It felt unreal," said Hanley, who has four goals in 221 NHL games. "It was great. Obviously, I don't score a lot, so whenever I can contribute offensively it feels really good. It was nice to get the win."

SJS@CGY: Hanley picks the corner to give the Flames the lead in the 3rd

Hanley's goal came after Toffoli tied it 2-2 at 1:54 of the third on a backhand off his own rebound.

"It was a tight game," San Jose forward Ty Dellandrea said. "I thought we played well, but not well enough to win. We've got to tighten some things up, let those goals not go in our net. But we executed a lot of things we wanted to do, just a late goal in the third."

Celebrini put the Sharks up 1-0 at 3:41 of the first period. He shot just over Wolf's left pad from the low slot off a centering pass from below the goal line by Toffoli.

Kadri tied it 1-1 at 7:27, scoring a power-play goal when his wrist shot deflected off Jake Walman's leg and by Georgiev's blocker.

Rooney gave Calgary a 2-1 lead at 3:35 of the second period, chipping a backhand past Georgiev's left pad after the goaltender made the initial stop on Ryan Lomberg.

The goal was Rooney's first in 24 games.

"You always want to try to contribute on the score sheet," Rooney said. "It does a lot. You can see the guys' excitement when you come back to the bench. Everybody gets a jolt when the fourth line gets one."

NOTES: Kadri extended his point streak to six games (three goals, five assists) and has three straight 20-goal seasons with the Flames. The only players in the previous 30 years to score 20 goals in each of their first three seasons with Calgary were Sean Monahan (seven), Daymond Langkow (four) and Rene Bourque (three). ... Toffoli has eight points (four goals, four assists) in a six-game point streak. ... Flames forward Connor Zary had three shots in 16:05 of ice time in his return after missing 15 games because of a lower-body injury. ... Calgary defenseman Kevin Bahl, who was activated off injured reserve after missing eight games because of an upper-body injury, did not play due to illness.