Andrew Mangiapane scored Calgary's last two goals, one of which came into an empty net at the end. Dylan Larkin had both goals for Detroit.
The Flames are in a tight race for the final postseason spots in the Western Conference, and the five-game trip they began Sunday could be crucial. This matchup - against a Detroit team with by far the NHL's worst record - wasn't terribly intimidating, and initially it looked like it might be an easy night for Calgary.
''This is the NHL. Any team you play can win any night,'' Monahan said. ''It comes down to how hard you're going to work, and how bad you want it.''
Gaudreau was alone in the left circle when he beat goalie Jonathan Bernier with a slap shot to make it 1-0. Monahan scored on a rebound 77 seconds later.
''I thought we started the way we wanted. We started on time,'' Flames coach Geoff Ward said. ''We were able to get out to the lead.''
Larkin, however, got behind Calgary defenseman Michael Stone and beat goalie David Rittich to make it 2-1 later in the first period.
The Red Wings stayed within a goal until the final minute of the second. That's when a slapper by Noah Hanifin appeared to carom in off the leg of Mangiapane with 10.6 seconds remaining.
''I thought we dug in in the second,'' Detroit coach Jeff Blashill said. ''I didn't think we were good enough in the first. I thought we had some guys playing and some guys were just in their jerseys.''
With Detroit's goalie pulled, Larkin made it 3-2 with 2 minutes remaining in the third when his wrist shot from the blue line sailed through traffic and past Rittich. Mangiapane sealed the win for Calgary with 11.8 seconds to play.
The Flames pulled into a tie for the first wild card in the West with Arizona. Those two teams are one point ahead of Winnipeg, which lost at Buffalo on Sunday.
''We told them not to watch the standings. We're in control of our own fate right now,'' Ward said. ''If you watch the standings right now, you're going to see a lot of different things. Teams are going to be in and out. It's so close on different days, depending on what happens.''
Detroit is 3-15-1 in its last 19 games. The Red Wings scratched forward Andreas Athanasiou and defenseman Mike Green, fueling speculation that at least one of them could be dealt before Monday's trade deadline.
''You don't know what's going to happen next. It could just be precautionary,'' Larkin said. ''That's what we were told.''
Green was traded to Edmonton in a deal announced a short while later. The Red Wings received forward Kyle Brodziak and a conditional draft pick from the Oilers. The pick will either be in the fourth round in 2020 or the third round in 2021.
NOTES: Calgary F Matthew Tkachuk had his eight-game point streak snapped.
Flames: At Boston on Tuesday night.
Red Wings: Host New Jersey on Tuesday night.
More AP NHL: https://apnews.com/NHL and https://twitter.com/AP-Sports
Follow Noah Trister at https://twitter.com/noahtrister
Copyright 2020 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.