The League Two outfit led through Alfie May’s second-half strike and with just nine minutes to play Michael Duff’s side were on course to reach the fifth round.
However, Phil Foden and Gabriel Jesus found the net in quick succession to break Cheltenham hearts, before Ferran Torres sealed the result deep into stoppage time to set up a meeting with Swansea in the last-16.
City almost took the lead inside 30 seconds when Jesus was denied by Josh Griffiths, while Ben Tozer produced a magnificent goalline clearance to clear Benjamin Mendy’s thumping effort.
Jesus also wasted a golden chance to open the scoring when played in by Foden after the break before Cheltenham went ahead as Tozer’s long throw caused chaos in the City box and May reacted fastest to poke home.
That left the League Two side just over half-an-hour to hold out and they were two-thirds of the way there when substitute Joao Cancelo picked out Foden with a terrific cross to level on 81 minutes.
Soon after, the turnaround was complete as Fernandinho’s pass over the top allowed Jesus to finish emphatically and Torres then swept home from Ilkay Gundogan’s cut-back to make it 3-1 in the 94th minute.