Crystal Palace deservedly edged a seven-goal thriller against West Ham to reach the 40-point mark targeted by manager Roy Hodgson and leave the Hammers in relegation trouble.
Former England boss Hodgson has led Palace to four wins in six games since returning as manager last month to almost certainly guide the Eagles, now 11 points clear of the bottom three, to safety.
Kick-off in south London was delayed by 15 minutes because of an issue with the turnstiles - but there was no shortage of action once the match got under way.
Although West Ham took an early lead when Tomas Soucek punished Michael Olise's failure to clear a corner, Palace swung the game in their favour with three goals in an impressive 15-minute spell.
Jordan Ayew levelled within six minutes with a first-time finish at the end a slick move, before the returning Wilfried Zaha finished from Eberechi Eze's pass across the six-yard box and Jeffrey Schlupp added a third after dispossessing Soucek.
A superb first-half took another twist when West Ham again capitalised on a corner, Michail Antonio heading in at the back post to reduce the deficit before the break.
Eze's penalty restored Palace's two-goal advantage midway through the second half after he was judged to have been fouled by Nayef Aguerd - but the Hammers defender made amends as the visitors responded with a scrappy third from yet another set-piece.
However, David Moyes' side could not find a late equaliser to boost their survival prospects and West Ham remain five points above the relegation places with five games remaining.
Exciting Palace delight Hodgson
These are the days that 75-year-old Hodgson returned to management for.
Although Palace's unbeaten start since his return to the club last month was ended at Wolves earlier in the week, a run of three wins and a draw had taken the Eagles to within touching distance of what Hodgson described as the "magical" 40 points required to confirm safety.
With the pressure seemingly lifted from his players' shoulders, Hodgson welcomed back captain Zaha after a four-match absence with injury as part of a fluid attack that delivered joyous moments for the home support.
Accompanied by Olise, Eze, Ayew and Schlupp in an energetic front line, Palace were lively from the outset and did not allow their early setback to derail their afternoon.
Soucek, a constant menace at corners, kept West Ham in the match with his set-piece threat and it was the Czech midfielder who reacted quickest when Olise's miscued header dropped in the six-yard box.
But, backed by a rocking Selhurst Park, the Palace response was emphatic.
Olise continued to display his promise and registered his ninth Premier League assist of the season - a tally bettered only by Kevin de Bruyne (16), Bukayo Saka (11) and Leandro Trossard (10) - when he picked out the run of Ayew for a well-taken finish before Ayew left Eze's pass at the front post, allowing Zaha to slot in.
Schlupp was then rewarded for his determined pressing, rolling the ball under Lukasz Fabianski as Palace threatened to run riot.
West Ham, whose midweek loss to Liverpool was only their second defeat in 11 games in all competitions, have found form at a vital point of the season - and Moyes' side were able to reduce the deficit before the interval through Antonio.
Yet while Moyes will likely feel aggrieved that Eze's penalty was not overturned - Aguerd appeared to make minimal contact with the forward - he can have few complaints about the result.
Aguerd was awarded the Hammers' third as he and Antonio combined at the back post to bundle in after Soucek's flick-on, but Palace held on to earn a victory they deserved to all but secure their Premier League status.
West Ham, meanwhile, must watch on as their relegation rivals battle for points over the remainder of the weekend.
Player of the match
EzeEberechi Eze
Crystal Palace
Squad number10Player nameEze
Squad number7Player nameOlise
Squad number11Player nameZaha
Squad number9Player nameJ Ayew
Squad number4Player nameMilivojevic
Squad number22Player nameÉdouard
Squad number15Player nameSchlupp
Squad number28Player nameDoucouré
Squad number6Player nameGuéhi
Squad number16Player nameAndersen
Squad number3Player nameMitchell
Squad number2Player nameWard
Squad number21Player nameJohnstone
West Ham United
Squad number9Player nameAntonio
Squad number28Player nameSoucek
Squad number11Player nameLucas Paquetá
Squad number20Player nameBowen
Squad number41Player nameRice
Squad number27Player nameAguerd
Squad number1Player nameFabianski
Squad number5Player nameCoufal
Squad number8Player nameFornals
Squad number22Player nameBenrahma
Squad number18Player nameIngs
Squad number3Player nameCresswell
Squad number21Player nameOgbonna
Squad number33Player nameEmerson
Squad number4Player nameZouma
Squad number14Player nameCornet
Line-ups
Crystal Palace
Formation 4-3-3
21Johnstone
2Ward16Andersen6Guéhi3Mitchell
10Eze28Doucouré15Schlupp
7Olise9J Ayew11Zaha
21Johnstone2Ward16Andersen6Guéhi3Mitchell10Eze28DoucouréSubstituted forMilivojevicat 90+5'minutes15Schlupp7Olise9J AyewBooked at 15mins11ZahaSubstituted forÉdouardat 84'minutesSubstitutes
4Milivojevic5Tomkins8Sambi Lokonga13Guaita14Mateta19Hughes22Édouard26Richards44RiedewaldWest Ham
Formation 4-2-3-1
1Fabianski
5Coufal4Zouma27Aguerd33Emerson
28Soucek41Rice
20Bowen11Lucas Paquetá8Fornals
9Antonio
1Fabianski5CoufalBooked at 58mins4ZoumaSubstituted forOgbonnaat 19'minutes27Aguerd33EmersonSubstituted forCresswellat 45'minutes28SoucekBooked at 24mins41Rice20Bowen11Lucas PaquetáSubstituted forIngsat 69'minutes8FornalsSubstituted forBenrahmaat 45'minutes9AntonioSubstituted forCornetat 89'minutesSubstitutes
3Cresswell10Lanzini12Downes13Aréola14Cornet18Ings21Ogbonna22Benrahma24KehrerLive Text
Match ends, Crystal Palace 4, West Ham United 3.
Second Half ends, Crystal Palace 4, West Ham United 3.
Foul by Odsonne Édouard (Crystal Palace).
Nayef Aguerd (West Ham United) wins a free kick in the defensive half.
Delay over. They are ready to continue.
Substitution, Crystal Palace. Luka Milivojevic replaces Cheick Doucouré.
Delay in match because of an injury Nayef Aguerd (West Ham United).
Corner, West Ham United. Conceded by Joel Ward.
Substitution, West Ham United. Maxwel Cornet replaces Michail Antonio.
Attempt blocked. Saïd Benrahma (West Ham United) right footed shot from more than 40 yards on the left wing is blocked.
Attempt blocked. Joachim Andersen (Crystal Palace) right footed shot from the centre of the box is blocked. Assisted by Eberechi Eze with a cross.
Corner, Crystal Palace. Conceded by Nayef Aguerd.
Substitution, Crystal Palace. Odsonne Édouard replaces Wilfried Zaha.
Foul by Joel Ward (Crystal Palace).
Aaron Cresswell (West Ham United) wins a free kick in the defensive half.
Attempt blocked. Michael Olise (Crystal Palace) header from the centre of the box is blocked. Assisted by Marc Guéhi with a headed pass.
Jordan Ayew (Crystal Palace) wins a free kick in the attacking half.
Foul by Angelo Ogbonna (West Ham United).
Offside, West Ham United. Declan Rice tries a through ball, but Saïd Benrahma is caught offside.
Delay over. They are ready to continue.
Our coverage of your Premier League club is bigger and better than ever before - here's everything you need to know to make sure you never miss a moment