The visitors responded to Bayer Leverkusen’s win over Bayern Munich on Saturday by moving two points above their rivals thanks to Ibrahima Traore’s 86th-minute effort.
Max Kruse had given Gladbach a 12th-minute lead, only for Valentin Stocker to level two minutes later.
But substitute Traore snatched a winner at the death as he curled home an effort from the edge of the area for his first goal of the season, and Gladbach now host Leverkusen next weekend.
At the other end of the table, Hamburg left it even later to sink Mainz 2-1 and boost their survival hopes.
The visitors went in front after 38 minutes through Julian Baumgartlinger’s own goal, but Yunus Malli equalised 13 minutes from time.
Gojko Kacar drove home the winner two minutes from time to lift Hamburg a point clear of the bottom three.
Mainz had Daniel Brosinski shown a red card for a clash with Artjoms Rudnevs off the ball in the latter stages.