Andrew Copp and Alex Chiasson scored, and Hellberg made 35 saves for Detroit (29-27-9), which has lost seven of its past eight games (1-6-1).
"Second period burnt us," Red Wings coach Derek Lalonde said. "Our four penalties happened in the first 30-35 minutes (of the game), and it's just too much on our group. And it just gives their top guys too much momentum. So it's unfortunate because we had a really good opportunity."
The Bruins opened the second period with 12 straight shots on goal.
"[Detroit] pushed hard in the beginning of the game, and I thought in the second period we played our best hockey. Bruins hockey," Greer said. "It was just relentless and offensive driven, connected. A little slip [in the] third, but again, we're looking at it as, you know, we just got to make sure to overcome these hardships and these push backs that team gave us."
Lindholm cut it to 2-1 at 12:43 of the second, scoring with a shot through traffic from the point.
Dylan Larkin appeared to extend the lead for Detroit 45 seconds later, but the goal was waved off after he was called for interference. On the ensuing power play, Bergeron tied it 2-2 at 14:11, redirecting Jake DeBrusk's pass in the slot.
"Tough swing there," Larkin said. "We think we go up 3-1, and they call the penalty late. … But we responded well, and we had a good third period. We just came up short, and it was really hard tonight, but I thought it was a good effort because we battled a lot out there."
Ullmark kept the game tied at 10:11 of the third period by making a sprawling glove save on Chiasson, who received a pass from behind the net from Austin Czarnik
"[The Bruins] show why they're the team they are," Lalonde said. "They push in the second. Their goalie is the Vezina winner with the way he played in the third, and they found a way in the end. But again, I'm most encouraged, at 2-2, the play of our third (period)."
Hathaway then gave Boston a 3-2 lead at 13:54 of the third, finishing the rebound of A.J. Greer's shot on a 3-on-2 rush with his backhand.
"Our game is moving through the zones, trying to get into the [offensive] zone," Hathaway said. "I think we were hoping to wear [Red Wings goalie Magnus Hellberg] down a little bit tonight. Then the goal for the [fourth] line was just kind of the cherry on top."
Copp gave the Red Wings a 1-0 lead with a short-handed goal at 1:36 of the first period, shooting blocker side from the right circle on a 2-on-1 following a turnover by David Krejci.