Angelo Ogbonna headed home in stoppage time of extra time as West Ham United stunned a youthful Liverpool team 2-1 in Tuesday's FA Cup fourth-round replay at Upton Park.
Philippe Coutinho's clever free-kick had cancelled out Michail Antonio's volleyed opener for West Ham and the game was seconds from a penalty shootout when Dimitri Payet curled a free-kick into the visitors' box from the right and Ogbonna rose at the back post to head in the winner.
However, Jurgen Klopp predicted brighter days ahead for his Liverpool youngsters.
A team featuring two players aged 20, a 21-year-old, two 22-year-olds and 18-year-old midfielder Pedro Chirivella stood toe-to-toe with West Ham at Upton Park until Italian centre-back Ogbonna headed home in injury time of extra time to give the hosts a 2-1 win.
It leaves the Europa League as Liverpool's only realistic hope of silverware this season - they are currently 12 points below the Champions League places in the Premier League - but Klopp says it is all part of the learning curve for his players.
"We are Liverpool FC and this moment is not the most sunny side," said the Liverpool manager, who missed his team's 2-2 draw against Sunderland on Saturday as he was having his appendix removed.
"But tomorrow when we get up... the sun will shine. And if we want, at Liverpool, altogether, then we can take a lot of positive things out of this game.
"We have to make steps. We don't like our results too much, to be honest, but it's the difficult way we have to go. In the end it can be the right way."
As well as giving more game time to the younger members of his squad, the trip to east London also allowed Klopp to welcome several key players back from injury.
Philippe Coutinho scored a cunning free-kick on his return after a month out with a hamstring injury, steering a shot beneath West Ham's jumping wall in the 48th minute to cancel out Michail Antonio's volleyed opener.
Strikers Daniel Sturridge and Divock Origi also made comebacks as second-half substitutes, with the former in particular looking sharp in his first appearance since December 6.
Sturridge has made just four starts this season due to a litany of niggling injuries and Klopp said he would carefully manage the pace of the England striker's reintegration.
"We have to talk first with Daniel before I make a decision about this (on how much he plays)," Klopp said.
With West Ham due to leave Upton Park for London's Olympic Stadium at the end of the season, manager Slaven Bilic said that victory had been especially memorable.
"It is a great night for West Ham," said the former Croatia manager, whose side will visit second-tier Blackburn Rovers in round five.
"It was a late-night kick-off, it was against Liverpool. It's our last season at Upton Park, it's over 120 minutes, and we scored a great header in the last second of the game, and we had injuries - and we overcame all of that.
"So that's why this game will go down in history as one of the greatest nights and games for our club."
Dimitri Payet set up Ogbonna's 121st-minute winner with a typically devilish cross from a free-kick, hours after West Ham confirmed they have opened talks with him over a new contract.
The 28-year-old France international, a close-season signing from Marseille, is reportedly the subject of interest from an unnamed Chinese club and Bilic said West Ham were desperate to keep him.
"We should do everything we can to keep our best players," he said. "Dimitri Payet is our best player.
"I think he's very happy here and soon we're going to sort out the situation."