Scott Gomez and Hal Gill broke into the Calgary zone and were joined by Subban for a 3-on-2 rush. Subban took a pass from Gomez and wristed the puck over the glove of Henrik Karlsson for the game winner.
The victory came after the Habs squandered a 4-0 lead and allowed them to remain two points behind Boston atop the Northeast Division.
Goals by Lars Eller, Michael Cammalleri, Andrei Kostitsyn and Jeff Halpern put Montreal ahead 4-0 early in the second period. But Rene Bourque, Jay Bouwmeester, Ales Kotalik and Alex Tanguay answered for the Flames.
Canadiens goalie Alex Auld was yanked early in the third period after allowing four goals on 24 shots and Carey Price came in to stop all four shots he faced.
Flames starter Miikka Kiprusoff was also benched after yielding four goals on 17 shots. Karlsson ended up making 11 saves.