Flames veteran Michael Cammalleri broke a 3-3 tie with only eight seconds left in the second period to give Calgary two points in the Western Conference standings.
Cammalleri also led the Flames in scoring with a goal and an assist for two points.
Calgary took the 2-0 lead after the first period, before the Rangers marched back with three second period goals of their own. Flames enforcer Kevin Westgarth then scored his third of the season to tie the game at three before Cammalleri's game winner.
With seven games to go in the regular season, the Rangers currently sit in second place in the Metropolitan Division with 86 points. They are six points up on the Washington Capitals, Toronto Maple Leafs, Columbus Blue Jackets and Detroit Red Wings for a playoff spot.
Calgary's next game will be in Ottawa on Sunday evening.