Philippe Coutinho almost broke the Bolton Wanderers net and certainly broke the hosts' hearts with a magnificent late strike to send Liverpool into the fifth round of the FA Cup where they face Crystal Palace.
It was an astonishing goal, capping an amazing turnaround. Bolton had done brilliantly, playing with belief, taking the game to their Premier League visitors, parading the skills of young Zach Clough, and taking the lead when he was, apparently, fouled by Martin Skrtel, and Eidur Gudjohnsen stroked in the penalty.
Liverpool had to rally, and Brendan Rodgers sent on striker after striker, Fabio Borini and Daniel Sturridge, laying siege to the Bolton goal. Liverpool had an attack late on of Raheem Sterling, Sturridge, Borini and the wonderful Coutinho.
Bolton's hopes were not helped by Neil Danns being sent off for a second offence, and Liverpool ultimately made them pay. Sterling scored with a shot and then, deep into injury time, Coutinho completed the comeback.
It was brutal on Bolton, whose fans saluted their players loudly at the final whistle. They had defended so well, especially the likes of David Wheater. Their keeper, Andrew Lonergan, made some exceptional saves but there was an irresistible momentum from Liverpool late on. They did not want to follow Chelsea and Manchester City out of the Cup. They did not want another half-hour's exertion with Everton up on Saturday. But they needed some real magic from Coutinho to end Bolton's resistance.
However frustrated, Bolton can take pride from the performance and the reality that they troubled one of the Premier League's finest for so long, even taking the lead against them.
Gudjohnsen's penalty after 59 minutes had rolled back the years, reminding Bolton fans of his early pomp.
It was a deep frustration for Liverpool, who had tried so hard to break through. Brendan Rodgers's side had moments of hope in the scoreless first half, particularly when Sterling and Coutinho were running at goal but they found Bolton's defence standing firm, doing so well that Neil Lennon's players were applauded off by their supporters at the break.
Lonergan was starting in goal for Bolton after the unfortunate ankle injury suffered by Adam Bogdan in training, depriving the shot-stopping headline-grabber of the first game of a chance to deny Liverpool again.
Lonergan immediately impressed, dropping low to stop a shot from Steven Gerrard and frustrate the Liverpool statisticians as well as the Liverpool captain.
The visitors were chasing their 700th FA Cup goal as Gerrard made his 700th appearance for the club in boots with the number 700 stitched into the heel. Only Jamie Carragher (737) and Ian Callaghan (857) played for Liverpool more. Gerrard then had to close down a run from the hugely promising Clough, the Bolton youngster who had darted away from Joe Allen.
Clough may need to acquire some upper-body strength and work on his decision-making but he looks a breath of fresh for Bolton, a symbol of the new dynamism under Lennon. Making only his third appearance, the 19-year-old was always looking for the ball, always looking to turn quickly away from his marker, often bemusing them as Skrtel was to discover in the second period.
Clough looks a huge talent on this evidence.
Clough was playing in the hole behind Gudjohnsen, who was partnered by Matt Mills in the absence of Emile Heskey with a hamstring strain.
The game was very open, flowing from end to end. Sterling exchanged passes with Adam Lallana and drew a low save from Lonergan. Back down the other end the game went. Gudjohnsen skied a left-footed shot over the crossbar.
Back came Liverpool, Coutinho making a glorious run through midfield, juggling the ball over Danns and Liam Feeney.
Clough continued to impress, picking the ball up deep, and driving at the heart of the Liverpool defence. Danns was lively, breaking up Liverpool attacks and sweeping forward with the ball, soon winning a free-kick. Wheater met the ball, powering a downward header which was clutched by Simon Mignolet.
On it went, some of it eye-catching, some excruciating. Dorian Dervite unleashed a shot that turned into a crossfield pass. Then Sterling wriggled through, opening some space, beating Lonergan but not the keeper's right-hand upright.
Liverpool could not break Bolton down in the first half. Wheater was immense, dominant on the ground and in the air. Dervite put in a great tackle on Coutinho. Lonergan held a Lallana 25-yarder before watching Coutinho shoot just wide.
Liverpool kept going close. Eight minutes into the second half, Josh Vela lost the ball to Coutinho, who released Sterling. Dervite put another fine challenge but Sterling was quick to the loose ball. This time he was thwarted by Lonergan, who caught his curling effort.
Then came that moment of controversy just before the hour. Clough dribbled into the box and was challenged by Skrtel. Contact seemed minimal but referee Roger East pointed immediately to the spot. However questionable the decision, there was no questioning the substance of the penalty. Gudjohnsen calmly deceived Lonergan and placed the ball firmly in the net.
As Bolton fans were still singing about Wembley, they lost Danns to a second yellow, this time for a foul on Allen after 65 minutes.
Rodgers sent on Daniel Sturridge, who was greeted with warm applause by the Bolton fans, who remember his loan spell here. Yet it was Bolton who almost scored next but Gudjohnsen was denied by Lonergan. Then Wheater got in the way of a Jordan Henderson strike, diverting the ball away
Liverpool, attacking the end containing their anxious fans, lay siege to Lonergan's goal. Henderson went close. Gerrard drove the ball across goal, and when nobody in red made contact, Bolton fans let out a cry of relief and delight.
As the clock ticked down, Emre Can let fly from 25 yards and the ball seemed heading inexorably into the net. But Lonergan had read the danger, and managed to stretch out a finger and tip the strike on to the bar.
Bolton fans were willing their team to hold out, loving it when Mills took the ball down to the corner flag after 85 minutes. They shouted their approval when Wheater thumped the ball clear. But then came Sterling, collecting a superb pass from Can, and angling his shot in past Lonergan to keep hopes of a farewell Wembley appearance for Gerrard alive.
Just when extra-time loomed, Coutinho struck, triggering a mass, writhing celebration amongst the Liverpool fans and heartache around the rest of the stadium.