Substitute Pablo Fornals scored a stoppage-time winner to prompt ugly scenes at the final whistle, with West Ham players and coaching staff trying to stop AZ ultras from attacking away fans behind the dug-out.
It was a shameful end to a battling performance from the Hammers as they secured a 3-1 victory on aggregate.
A year earlier West Ham had lost the plot at the same stage of the Europa League, crashing out at Eintracht Frankfurt after Aaron Cresswell was sent off and David Moyes booted a ball at a ball boy.
But this time West Ham held on to their composure, and no ball kids were harmed, as they booked a first European final in 47 years, and the chance of some first silverware since the 1980 FA Cup, in Prague on June 7.
It was no mean feat despite the less-than illustrious opposition. AZ have a phenomenal home record in Europe, unbeaten in their previous 25 matches, and had only lost here once to an English team - Moyes’ Everton in 2007 which ended a run of 32 games without defeat.
Since then Manchester United, Arsenal, Valencia and Lazio have all tried, and failed, to win at the AFAS stadium, a ground that is such a fortress it even has a moat surrounding it.
So West Ham’s 2-1 lead from the first leg always looked slim, and none more so than when AZ dangerman Jesper Karlsson had a shot deflected over with only one minute on the clock.
But West Ham, cheered on in the away end by former striker Andy Carroll held their nerve and allowed AZ to keep possession and play in front of them, while looking to pounce on the break.
Thilo Kehrer began to get some joy down the right and when his cross was headed away from Michail Antonio it fell to Jarrod Bowen, who lashed his shot wide.
Lucas Paqueta twice tried to send Antonio through on goal, the first after a 40-yard run up the pitch, but twice the pass was too long.
Yet the Brazilian was slowly exerting his influence on the match and when he collected the ball from Antonio, he cut inside on his left foot and his curling shot from the edge of the box just clipped the far post.
West Ham hearts were in mouths before the interval, however, when a low cross from Milos Kerkez rolled menacingly across the six-yard box before it was half-cleared and the follow-up from Vangelis Pavlidis was deflected wide.
Hammers goalkeeper Alphonse Areola had little to do in the first half, but he was tested early in the second and held a drive from Sven Mijnans before tipping a Pavlidis shot over the top and saving from Pantelis Hatzidiakos.
Likewise home keeper Mathew Ryan, who then had to paw away a 20-yard effort from Declan Rice.
West Ham had fallen foul of some of Europe’s dark arts last season, but here they were holding their own; Tomas Soucek and Kehrer were both booked for timewasting at throw-ins.
Nayef Aguerd sliced a chance to put the tie to bed wide as the clock ticked down, but in stoppage time Fornals raced clear of a tiring AZ defence and slotted the ball past Ryan in front of the delirious 900-odd travelling supporters.
Moyes, Rice and others then had to leap over advertising hoardings and try to prevent the hooligans from attacking the West Ham friends and family area behind the dug-out.
It was not a nice ending, but when the dust settles Rice, destined to leave West Ham this summer, will know he now has the chance to join Bobby Moore and Billy Bonds as the only captains to lift a major trophy for the club, and what a parting gift that would be.