With just ten minutes of normal time remaining, birthday boy Wilfried Bony, who arguably helped turn the game, sealed a 4-2 win three minutes later.
The Blues had trailed 2-1 since the break - despite going ahead through David Silva’s - early thunderbolt before being pegged back by the German side.
With Sevilla beating Juventus in the other group game, City’s Champions League stars finally aligned to top the group at the death, but the night belonged to Sterling who couldn’t have celebrated his 21st birthday in more memorable fashion.
The evening began with Blues needing to beat an in-form Monchengladbach and hope Sevilla’s love affair with the Europa League would prove strong enough to inspire them to victory over Juventus, but few were holding their breath believing that scenario would actually happen.
Italian sides have a well-earned reputation of grinding out a result when they really need it, but City were not about to throw in the towel just yet.
Yaya Toure made a welcome return, as did Eliaquim Mangala and Gael Clichy with Wilfried Bony, Bacary Sagna and an injured Martin Demichelis making way
...City v BMG...
The Germans, fresh from a 3-1 win over Bundesliga champions and runaway leaders Bayern Munich understandably made no changes from the weekend.
Coach Andre Schubert had guided his side from bottom to third in the table and his team arrived unbeaten in 12 – City being the last side to beat them back in September some eight wins and four draws ago.
The Blues, still licking their wounds from a season low at the Britannia on Saturday began brightly with Kevin De Bruyne and Sterling free to roam and find space with Silva tucked in behind and it didn’t take long before the fluidity in City’s attack was rewarded with a goal.
Silva found Sterling on the edge of the Borussia box before continuing his run where he was found by Sterling’s neat flick and the Spaniard thumped a shot high past Yann Sommer and into the roof of the net with just 16 minutes played.
The joy was short-lived, however, as the visitors drew level within three minutes following a counter-attack that found Julian Korb in space ten yards from goal and the Gladbach midfielder drilled a low shot past Joe Hart, much to the delight of the 4,000 visiting supporters.
It was a little harsh on City who had been bright and inventive without really being troubled at the back – but, as we all know, there is little room for error in this competition.
The Blues pressed well and Borussia were forced into several mistakes at the back, but the numerous crosses Sterling, Aleks Kolarov and De Bruyne put into the box went begging and just before half-time the Germans struck again as Oscar Wendt’s cross found its way to Raffael who bundled the ball home from close range.
All of a sudden, finishing group runners-up looked a certainty with Pellegrini’s side looking fragile at the back and with a mountain to climb on the night
...City v BMG...
Sterling came within a whisker of levelling just before the hour as the pattern of City domination possession continued after the break, but Sommer denied him with a smart save from point blank range.
Five minutes later Kolarov picked Sterling out in the box with a low cross but with a clear sight of goal the England forward shot low and straight at Sommer who continued to defy the Blues.
It was all City, but the breakthrough just wouldn’t come and with 80 minutes played, all seemed lost in the quest to top Group D.
But then, like buses, three goals came along in the space of five minutes!
The first - the equaliser - came as Gael Clichy’s low cross was turned home by Sterling who arrived on cue to finally beat Sommer.
With the home fans still on their feet, Bony broke clear, lost his marker and fed the birthday boy who finished with a sublime curling drive two minutes later to send the Etihad wild and edge the hosts’ noses ahead once again.
It was an incredible turnaround by the Blues who deserved to be ahead for perseverance alone – but the goal frenzy wasn’t over and as Kolarov whipped in a cross from the left and Bony saw one attempt blocked but made no mistake when the ball fell back to him to score City’s third goal in five crazy but ecstatic minutes.
It was a breath-taking finale to a game that had looked for so long ending in frustration and the Blues will now go into the Round of 16 as group winners for the first time. Quite a night…