Sergio Aguero scored a 92nd-minute winner to rescue a 2-1 victory for Manchester City in the first leg of their EFL Cup semi-final against a valiant Bristol City side at the Etihad Stadium this evening.
Bristol City, who have already knocked out four Premier League teams in this season's competition - including Manchester United in the quarter-finals - looked on course for another giant-killing when Bobby Reid capped off an impressive first-half showing with the opening goal from the penalty spot just before the interval.
Kevin De Bruyne restored parity 10 minutes into the second half, but it looked as though Lee Johnson's Championship side had done enough to halt Man City's run of 15 consecutive home wins and become only the second visiting team to avoid defeat at the Etihad this season.
However, Aguero popped up with the winner in the second minute of injury time to hand Man City the slender advantage heading into the second leg at Ashton Gate in a fortnight's time.
Pep Guardiola opted to start Aguero on the bench, but his fellow goalscorer De Bruyne was one of the star names to return to the side and the Belgian was the first to threaten with a whipped effort towards the top corner which Frank Fielding had to claw away.
Ilkay Gundogan was the next to find himself in a shooting position for the hosts when he fired a 25-yard strike well wide, before Bernardo Silva's deflected effort looped up and rippled the side-netting on its way behind for a corner.
Bristol City were more than holding their own against the Premier League leaders, though, and they were the first to draw a serious save from either keeper when Joe Bryan's 25-yard strike was kept out by Claudio Bravo.
The Championship outfit were eager to press Man City high up the field as well as playing out from the back, but the latter tactic almost cost them when they gave possession away cheaply inside their own half, only for Bernardo to skew his eventual finish well wide of the target.
It was a similar story five minutes later when Bristol City gifted the ball to De Bruyne on the edge of the area, but Fielding was once again equal to his ambitious curling effort from the left side of the box.
Bravo was worked every bit as hard as his opposite number in the first half, though, and the Chilean goalkeeper needed to be sharp shortly after the half-hour mark to keep out Marlon Pack's strike from the edge of the area.
Man City's grip on the game did begin to grow as the first half wore on but they still struggled to find a way past the Bristol City rearguard, with Eliaquim Mangala, Gundogan and Bernardo all failing to hit the target with presentable opportunities.
Indeed, it was the visitors who opened the scoring against the run of play with just one minute remaining of the first half after Mangala had given the ball away and John Stones had then brought Reid tumbling to the ground with a rash challenge inside the box.
Referee Anthony Taylor has no hesitation before pointing to the spot, and Reid stepped up himself to tuck the penalty into the bottom corner despite Bravo guessing the right way.
The visitors were suddenly contemplating a fifth successive Premier League scalp in the competition, but Man City quickly brought them back down to earth with a golden opportunity to restore parity within two minutes.
Raheem Sterling was released through on goal down the right channel and looked to have levelled things up when he lifted his finish over Fielding, but Aden Flint got back to use every inch of his giant frame and flick the ball over from beneath his own crossbar.
For the second game in a row Man City went into the break trailing at home, but they came flying out of the blocks for the second half and Sane dragged one effort wide before Sterling stung the palms of Fielding at the end of a quick counter.
The equalising goal did arrive 10 minutes into the second half following another lightning break which saw De Bruyne leading the charge before exchanging passes with Sterling inside the area and sweeping an emphatic finish past the keeper.
It was a nervous start to the second half for Bristol City, who also picked up three yellow cards between the restart and the hour mark, but they soon began to regain their composure and slow the home side's momentum.
Man City still looked the most likely to get the winner, though, and both Sterling and Leroy Sane should have done better with a couple of chances in quick succession with just 20 minutes to go.
Guardiola soon turned to Aguero to try to change things, but Bristol City kept their star-studded hosts at bay until the 87th minute when De Bruyne sprung into action, beating a couple of defenders before poking his finish wide of the target.
The visitors had spent the majority of the second half on the back foot, but they had half a chance to steal a famous victory just two minutes later when the ball fell to debutant Liam Walsh inside the box, only for the former Everton man to rush his effort and skew it off target.
The finish line was in sight for Bristol City, but not for the first time this season Man City left it late to rescue victory from the jaws of a draw when Aguero ensured a first-leg advantage for his side.
The Argentine darted in front of his marker and Fielding to get on the end of Bernardo's inviting ball into the box, bravely steering his header into the unguarded net to break Bristol City's hearts with the final meaningful action of the match.
It was harsh on the visitors, who had put up a much more even fight than many teams ranked a lot higher than them in the football pyramid this season, but they are at least still within striking distance of the Premier League leaders for the return leg at Ashton Gate.
Man City, meanwhile, have now equalled a club record of 16 successive home wins across all competitions - which was initially set in 1920-21 - as their march towards a potential quadruple continues.
Guardiola's side will now turn their attentions to a Premier League showdown with Liverpool at Anfield on Sunday, while Bristol City will look to snap a run of four straight defeats and get their promotion push back on track against Norwich City.
MAN CITY (4-3-3): Bravo; Danilo, Stones, Mangala, Zinchenko (Walker, 79'); De Bruyne, Toure (Aguero, 70'), Gundogan; Bernardo, Sterling, Sane
BRISTOL CITY (4-4-1-1): Fielding; Wright, Flint, Baker, Magnusson (Walsh, 72'); Brownhill, Pack, Smith, Bryan; Paterson; Reid