Calgary owned a 3-0 lead after one period but the Coyotes closed the deficit to a single goal heading into the third.
It remained a 3-2 contest until Jarome Iginla scored into an empty net with 47 seconds left in regulation.
The Flames snapped a four-game losing streak that has seen Calgary slip out of a playoff position in the Western Conference. Phoenix had won six in a row to take over the top spot in the Pacific Division.
Calgary scored three times in the final 5:51 of the opening period. Mike Cammalleri opened the scoring and, after Glencross produced his shorthanded tally, Olli Jokinen delivered what turned out to be the game-winning goal.