DENVER -- The Calgary Flames were ready to celebrate another win at Pepsi Center.
After all, they had made Denver their second home, winning seven of their last eight in Colorado, including seven straight at one point.
Leading 3-0 after 20 minutes, they were already counting on win No. 8.
The Colorado Avalanche had other ideas. Gabriel Landeskog had a goal and two assists and the Avalanche scored three times in the third period to beat the Flames 5-4 on Thursday night.
Matt Duchene and Paul Stastny had a goal and an assist each for Colorado. David Jones and Ryan O'Byrne also scored for the Avalanche, got their first regulation home win against Calgary in three seasons.
"The only explanation I can give you guys is we felt it would be easy," Flames coach Bob Hartley said. "On every goal there were major breakdowns, whether it was bad decisions or lack of effort. We played a great first period and found a way to throw it to the dumpster."
Jarome Iginla scored twice for the Flames.
"That's as hard as any loss this year," Iginla said. "There's no way that should happen."
The game was a sidelight to the teams' matchup off the ice. Early Thursday, the Flames announced they had signed Avalanche restricted free agent Ryan O'Reilly to an offer sheet. Hours later, when the teams were in the first period, Colorado announced it had matched the offer to retain its leading scorer from last season.
The terms of the deal weren't released, but TSN in Canada reported the contract was for two years and $10 million. According to TSN, O'Reilly will get $1.5 million this year, $6.5 million the second year and a $2 million bonus.
"It shows that we aren't going to let one of our top players go for draft choices," Stastny said. "Management wasn't hesitant to match it. They didn't wait seven days. Doing it right away shows that they are committed."
Flames general manager Jay Feaster said the Flames discussed trading for O'Reilly but "the price to acquire the player via trade was too steep. We felt it would negatively impact our future, so we made the decision to go ahead with the offer sheet."
Colorado GM Greg Sherman said the Flames' decision was business.
"It's their right within the CBA to put that offer sheet forward and we have our rights within the CBA to match it," Sherman said. "If that's the way they want to do their business, that's their right. The fact that we received the offer the day of the game, against them, that's their prerogative. That's their business."
Perhaps buoyed by the news their teammate was back, the Avalanche rallied. They got within 3-2 midway through the second period on goals by O'Byrne and Jones. Iginla gave the Flames a two-goal cushion with his fifth goal of the year with 6:44 left in the period.
Landeskog scored 23 seconds into the third to cut it to 4-3 and Stastny tied it off a rebound six minutes later.
"We knew we needed just that one goal," Landeskog said. "We got it and we kept going to get that next one. When we took over momentum the crowd fed off of that."
Duchene got the winner midway through the third, his seventh goal of the season.
"We had a great second period. We got the two goals to get back into it," Duchene said. "Even to be down two coming out of the second, we got the goal right away on the power play and then one from Landeskog."
Calgary took a 2-0 lead when Jay Bouwmeester and Mike Cammalleri scored 33 seconds apart five minutes into the game. Iginla made it 3-0 with 54 seconds left in the first.
Then it all fell apart for the Flames.
"We just stopped playing. We had the game three-zip and we're going back home," Hartley said. "We didn't deserve it. They deserved it. They outworked us in the second, they outworked us in the third. At 3-zip we had the game fully in control so we only have us to blame."
NOTES: The two-goal game was the second of the year for Iginla. He has 92 career goals against Colorado ... Duchene finished February with a team-leading 12 points (five goals, seven assists). ... The Flames on Thursday traded defenseman Joe Piskula to Nashville for forward Brian McGrattan. McGrattan, who signed a one-year contract with the Predators last summer, has not played a game for Nashville this season. He recently finished a two-week conditioning assignment in the AHL. ... The Flames are one of four teams in the league to have not allowed or scored a short-handed goal. Anaheim, Minnesota and Phoenix are the others. ... Varlamov has started 16 of Colorado's first 20 games.