Newcastle United's Kieran Trippier endured a Stamford Bridge nightmare as Chelsea reached the Carabao Cup semi-finals after a penalty shootout.
Callum Wilson's 16th-minute goal looked to be sending Newcastle into the last four until substitute Mykhailo Mudryk pounced on the veteran defender's error deep into stoppage time to send the game to spot-kicks.
The 33-year-old, who has suffered a dip in form recently, then fired Newcastle's second penalty wide and once keeper Djordje Petrovic saved Matt Ritchie's spot-kick Chelsea had gone from the despair of contemplating defeat to the sheer elation of a place in the last four.
It was cruel on Trippier, such an influential figure under manager Eddie Howe, but his fatal indecision on a header gave Chelsea that lifeline which Mudryk gratefully accepted.
Cole Palmer, Conor Gallagher, Christopher Nkunku and Mudryk were all on target for Chelsea but only Callum Wilson and Bruno Guimaraes scored penalties for Newcastle, who suffered fresh disappointment after their Champions League exit.
The draw for the semi-finals takes place after Liverpool v West Ham on Wednesday, with the first leg of those ties being played in the week commencing 8 January.
Following Mudryk's equaliser a male Chelsea fan climbed over the advertising hoardings before celebrating in the face of and bumping into Newcastle goalkeeper Martin Dubravka.
The fan was then led back into the crowd with referee Jarred Gillet speaking to stadium security before the shootout began.
Christopher Nkunku scored his penalty in the shootout after coming off the bench to make his Chelsea debut
Chelsea may look back at the late twist in the tale here at Stamford Bridge as the moment they can use to try and finally kick the Mauricio Pochettino era into gear.
Pochettino's side were looking a damaging defeat squarely in the face until Trippier, his mind perhaps scrambled by recent mistakes, touched a tame header into Mudryk's path to set up the drama of penalties.
Chelsea strived to get back on terms after Wilson's early goal, the result of a comedy of defensive errors that ended with Benoit Badiashile stumbling over the ball to let the striker through.
There were chances that were not taken, such as when Bruno Guimaraes made a miraculous block on the goalline from Raheem Sterling, while Newcastle keeper Dubravka was outstanding when called upon.
Even the introduction of striker Nkunku for his debut after months on the sidelines following his £52m move from RB Leipzig could not force a breakthrough until Mudryk's moment of opportunism.
The scenes of celebration, led by Pochettino, on the Chelsea bench when the equaliser went in and then when Petrovic saved Ritchie's penalty demonstrated just how important this win is, and might prove to be, as the Argentine manager tries to put down foundations at this most volatile of clubs.
Trippier has arguably been Newcastle's most important figure on an off the pitch during the renaissance under Howe but there is no doubt he is currently suffering a miserable spell of form.
The England full-back was involved in all three goals conceded in the defeat at Everton then had a nightmare in the thrashing at Tottenham. He was culpable again here as Newcastle saw a heroic victory snatched away from them in the closing moments.
Trippier was introduced at the interval for the injured Emil Krafth then paid a heavy price for hesitation when making a header in the area halfway through four minutes of stoppage time, the ball dropping invitingly for Mudryk to beat Dubravka.
Newcastle's players, who fought so hard and could almost touch a place in the semi-final, slumped to the floor in agony and there was almost a sense of inevitability that Trippier, who did not look confident, would miss his penalty, which he did by shooting well wide in front of the visiting fans at the Shed End.
It was a bitter conclusion for Howe's side, who also saw Anthony Gordon added to their lengthy injury list after he limped off in the second half.
The visitors would also have a justifiable complaint that Chelsea should have been reduced to 10 men in the opening minutes when Moises Caicedo was very fortunate to only receive a yellow card for a very poor challenge on Gordon.
It has been a chastening week for Newcastle and Howe, with their challenges ended in both the Champions League and the EFL Cup.
Howe must now pick up his shattered players for the festive period and focus his side on making another bid to reach the Premier League's top four.