Bundesliga Wrap: Win sends Gladbach sixth
Struggling Hamburg, who would have climbed out of the relegation zone with a win, went ahead shortly before the half-hour mark when Jacques Zoua got on the end of a Hakan Calhanoglu free-kick to head home.
However, Michael Mancienne was penalised for a handball in the penalty area eight minutes before the break, allowing Filip Daems the opportunity to level matters from the spot.
The Belgian's strike was initially saved by goalkeeper Rene Adler, but he followed up well to make amends.
Raffael rounded Adler to put the hosts ahead at Borussia Park in the 75th minute, before Alvaro Dominguez tapped home at the back post from a corner three minutes later.
The result lifts Gladbach, who earlier confirmed the signing of winger Andre Hahn from Augsburg, to sixth, three points shy of the top four, while Hamburg remain two points adrift of safety.
In the day's other match, Werder Bremen netted a late winner to leapfrog opponents Hannover and boost their chances of Bundesliga survival in a match that ended 2-1.
The sides had been level on points heading into the weekend, and it was hosts Hannover who broke the deadlock just before the break through a long-rang Szabolcs Huszti free-kick.
Franco Di Santo found himself unmarked in the penalty area in the 57th minute as he found the space to pull Bremen level, before Sebastian Prodl charged into the penalty area to head home from a corner and complete the comeback in the 90th minute.
The win sees Bremen climb eight points clear of the relegation zone, while Hannover drop to 13th with a five-point cushion.