Said Benrahma and Michail Antonio both scored in the second half as West Ham came from a goal down to beat AZ Alkmaar 2-1 in their Europa Conference League semi-final first leg.
The Hammers were big favourites to beat the Dutch dark horses, but were put on the back foot at a sold-out London Stadium when goalkeeper Alphonse Areola gifted AZ the lead before half-time.
But another goalkeeping error from Australia international Mathew Ryan gave West Ham a penalty which Benrahma converted.
Antonio then prodded home from a corner after a goalmouth scramble to give the Hammers a crucial lead going into next Thursday’s second leg in the Netherlands.
There was a sense of optimism before kick-off with West Ham almost safe from relegation and captain Declan Rice confidently predicted ‘the good times are back on their way’ in his programme notes, even though it remains unlikely he will be here to enjoy them for much longer.
Still, a European final in Prague on June 7, against Fiorentina or Basel, would be a fitting way for the England midfielder to sign off before a big-money summer move.
But AZ, a progressive club based around the moneyball model also used by Brentford, are a slick, attacking young side who had beaten Lazio and Anderlecht to reach the last four.
They were watched from the directors’ box by Billy Beane, the real-life inspiration for Brad Pitt’s character in the baseball movie Moneyball, who owns a stake in them.
Ominously, AZ goalkeeper Ryan was unbeaten in his five previous matches against West Ham during his spell at Brighton, and he set about trying to maintain that record when he got down well to tip Benrahma’s curler behind.
West Ham were given a painful lesson in last season’s Europa League semi-final, conceding in the first minute of the first leg and losing Aaron Cresswell to a red card in the second as they crashed out to Eintracht Frankfurt.
They got an early warning when former Southampton midfielder Jordy Clasie fizzed a low shot just past the post.
And history repeated itself when West Ham allowed AZ to take a shock lead five minutes before half-time, Areola letting Tijjani Reijnders’ shot in at his near post.
It was not a gaffe on the scale of the one West Ham benefitted from in their win over Manchester United on Sunday, when David De Gea let Benrahma’s tame shot roll in, but it was still not a good look for the Hammers’ cup keeper.
West Ham protested that there had been a foul on Lucas Paqueta in the build-up – Turkish referee Halil Umut Meler even put the whistle to his lips before opting to play on – but the goal stood.
However, the hosts were thrown a lifeline in the 67th minute when Ryan missed his punch at a corner and caught Jarrod Bowen square in the face.
Meler, who had infuriated the home crowd all match, pointed to the penalty spot and Benrahma stepped up to bury a perfect spot-kick just inside the post.
Eight minutes later West Ham went ahead, Antonio stabbing home the rebound after Nayef Aguerd’s header was cleared off the line to give them a slim advantage and, if they improve next week, every chance of moving a step closer to a first European trophy since 1965.