Jeremy Swayman replaced starting goalie Linus Ullmark at 11:36 of the second period for the Bruins (9-1-0) before sustaining a lower-body injury when Patrice Bergeron fell into him at 5:42 of the third period. Swayman, who was being evaluated after the game, made four saves.
Ullmark allowed five goals on 23 shots before being pulled. He finished with 29 saves on 34 shots.
Evgeni Malkin had a goal and an assist, and Tristan Jarry made 35 saves for the Penguins (4-4-2), who have lost five straight (0-4-1). They played without defenseman Kris Letang (illness).
"At the end of the day, we've got to find a way to win games," Pittsburgh coach Mike Sullivan said. "When you've got a two-goal lead heading into the third, you're in a good position to win. We had opportunities to win. We didn't take advantage of it."
Taylor Hall scored Boston's third straight goal on a spinning shot from the slot to tie it 5-5 with 1:17 remaining in the third.
"The cliche line is you keep playing, you keep believing," Hall said. "I think it's so true. We weren't getting run out of the building by any means. ... So, it's a huge win. Not that we're not a confident team, but to show that when you're down three, just keep chugging along."