The Canadiens had forged a 1-1 tie when Brian Gionta scored on a backhander with 28 seconds remaining in regulation.
But the Red Wings salvaged the victory as time was running out in the extra frame.
Todd Bertuzzi also scored for Detroit, which began post-Olympics play with a fourth win in six games.
Peter Budaj, starting in place of Carey Price, finished with 28 saves for Montreal, which had its three-game win streak ended.
Dennis Rodman pledges to end trips to North Korea
Teacher apologizes for showing sexual image of herself in class