Jarome Iginla had his 12th goal of the season - and eighth in his past seven games - and Rene Bourque also scored for the Flames, who had earned points in each of their previous six games.
Avalanche goaltender Craig Anderson made 34 saves, including a pad stop on a point-blank shot by Olli Jokinen with three minutes left in the third period.
Calgary goalie Miikka Kiprusoff made 21 saves as he lost in regulation for the first time in November.
McLeod converted a feed from Stastny past Kiprusoff to tie the game at 2-2 with two minutes left in the second period. Wilson had an assist on the play to double his total to four points on the season.
Just 66 seconds later, Hejduk attempted to hit Darcy Tucker with a cross-crease pass while the Avs were on a power play. The puck deflected off Jay Bouwmeester's skate instead and behind Kiprusoff to give Hejduk his eighth goal of the season.
Aided by an early power play, the Flames had the first six shots of the game but couldn't get one past Anderson.
The Avalanche then bounced back to send seven straight shots at Kiprusoff, scoring on one. After Kiprusoff made two straight pad saves on shots by Wojtek Wolski, Wilson crept in off the point and picked up a loose puck in the slot before backhanding a shot into the Calgary net eight minutes into the game.
At 11:39 of the second period, Curtis Glencross spotted Iginla wide open in the high slot and sent him a perfect pass that the Calgary captain one-timed into the top corner past Anderson.
About 5 1/2 minutes later, with the Avalanche on the power play, Bourque snapped a shot into the top corner over Anderson's outstretched glove to put Calgary up 2-1.
Prior to the play, Avalanche defenseman Kyle Quincy broke his stick when he took a slap shot from the point. Dustin Boyd alertly picked up the puck and sent it to Bouwmeester, who feathered a great cross-ice pass to Bourque on the left wing in the Colorado zone.
NOTES: Glencross returned to Calgary's lineup after missing three games due to a suspension for a hit on Chris Drury of the New York Rangers during a 3-1 win for the Flames at home on Nov. 7. ... It was only the fifth time in 19 games this season the Flames failed to score the first goal of the game. ... Colorado played without injured defensemen John-Michael Liles (shoulder) and Ruslan Salei (back). Forward T.J. Galiardi, who suffered an ankle injury the last time the two teams played back on Oct. 28 in Calgary, also missed the game.