MISSED the match? Catch Up via beIN SPORTS CONNECT | 2-WEEK free trial
Leipzig fought back with second-half goals from Christopher Nkunku and Yussuf Poulsen before Sorloth's winning header in the 93rd minute after Gladbach led 2-0 at half-time thanks to strikes from Jonas Hofmann and Marcus Thuram.
"We delivered a top performance and deserved to win," Poulsen said.
"After a game like that, confidence is high and puts a spring in your step."
The victory keeps second-placed Leipzig two points behind leader Bayern Munich, which earlier romped to a 5-1 home win over Cologne.
Gladbach was in complete control at half-time after Hofmann netted an early penalty and Thuram used his shoulder to guide the ball into the net from a Breel Embolo header.
However, Sorloth came off the bench and inspired the second-half fight back.
The former Crystal Palace striker had a goal disallowed for handball before setting up Nkunku, who fired home Leipzig's first goal on 57 minutes.
Poulsen smashed home the equaliser on 66 minutes.
Leipzig had all the momentum and peppered the Gladbach goal before Sorloth's winning header deep into stoppage-time.