The Lightning, who trailed 1-0 and 4-2, are six points behind the Bruins for first place in the Atlantic.
"It was a tough night for everyone; I'm not sure anyone got to bed before 4 a.m. before a 5 p.m. start," said Lightning coach Jon Cooper, whose team beat the first-place Boston Bruins 5-3 on Saturday.
[WATCH: All Lightning vs. Red Wings highlights]
Anthony Mantha and Tyler Bertuzzi each had a goal and three assists for Detroit (17-48-5), which has won two straight after an 0-5-1 skid.
"Our motivation right now is being a spoiler," Mantha said. "We want to finish strong, like we did last year, and you can see a glimpse of that."
Video: TBL@DET: Bertuzzi buries give-and-go transition goal
The win was Detroit's first against Tampa Bay since Nov. 3, 2015, ending a 16-game winless streak.
"We've ended some other streaks like that -- we had one against Boston and we had one against Montreal -- but this one in particular means I don't have to hear about it all summer," said Red Wings coach Jeff Blashill, a close friend of Cooper's.
Brayden Point scored two goals for Tampa Bay (43-20-6), which is 3-1-1 in its past five games.
Video: TBL@DET: Point scores PPG after assist from Johnson
"We had two games really close together, and we were trying to feel things out in the first period," Point said. "We need to start games with more intensity, and I don't think we quite had that, but we picked it up as the game went along."
Robby Fabbri scored the winning goal in the shootout -- his first successful try in eight career attempts.
"You are usually working with a pretty small sample size when it comes to shootouts, and we know [Fabbri] has been scoring a lot in practice," Blashill said.
The five-minute overtime was played without a whistle and included a 3-on-1 Lightning break that didn't result in a shot.
"We had a couple chances we didn't take in overtime, and that three-on-one was obviously the biggest," Cooper said.
Fabbri gave the Red Wings a 1-0 lead at 10:11 of the first period, taking Bertuzzi's saucer pass and beating McElhinney for his 15th goal.
Video: TBL@DET: Fabbri opens scoring with breakaway goal
Point made it 1-1 with a power-play goal at 11:11 of the second period, shooting into an open net after Tyler Johnson dug the puck out of a goal-mouth scrum.
"That was a great play," Point said. "There was a puck battle in front and he won it and slung it over to me for an open net."
The Lightning took a 2-1 lead at 14:47 when Carter Verhaeghe's shot deflected off Luke Glendening's stick and past Bernier.
Dylan Larkin tied the game at 2 at 19:45, knocking in Mantha's pass for his 19th goal of the season.
Video: TBL@DET: Larkin nets Mantha centering feed in front
"We knew they played late last night so we wanted to get the jump on them," said Larkin, who had a goal and two assists before scoring in the shootout. "This hockey matters -- we're playing for our jobs."
Mantha gave the Red Wings a 3-2 lead with a power-play goal at 1:41 of the third period off Bertuzzi's pass.
The pair teamed up again to make it 4-2 at 3:24, Bertuzzi tapping in Mantha's pass to finish a 2-on-1 break. The goal was Bertuzzi's 20th of the season and was the fourth point of the game for each player.
"I thought our line played great," Bertuzzi said after he, Mantha and Larkin had 11 of Detroit's 12 points.
Point scored his second of the game at 5:55, bringing the Lightning within 4-3 with a shot that deflected off Alex Biega's stick and knuckled over Bernier's shoulder.
Video: TBL@DET: Point flicks second goal home off the rush
Pat Maroon made it 4-4 at 11:19, knocking home a rebound for his ninth goal.
They said it
"I didn't think we made too many errors tonight, but the ones we were made glaring. We can't give Fabbri a breakaway and we can't let them get back door on a 2-on-1 in the third. But we got it to the shootout and you never know what happens there." -- Lightning coach Jon Cooper
"They are an explosive team and they are going to score goals, but we stuck with it and [Fabbri] made a great move in overtime and [Bernier] stood on his head for us again." -- Red Wings forward Tyler Bertuzzi on losing a 4-2 lead
Need to know
Defenseman Mikhail Sergachev scored in the first round of the shootout, his first career goal in his second attempt. … Bertuzzi and Mantha were the first Red Wings to each have four points in the same game since Johan Franzen and Gustav Nyquist did it in a 7-4 win against the New Jersey Devils on March 7, 2014.
Lightning: At the Toronto Maple Leafs on Tuesday (7 p.m. ET; TVA Sports, TSN4, SUN, NHL.TV)
Red Wings: Host the Carolina Hurricanes on Tuesday (7:30 p.m. ET; FS-D, FS-CR, NHL.TV)
Video: Red Wings defeat Lightning for first time since 2015