Stewart Downing put the Hammers in front at Upton Park but the Toffees hit back just six minutes later through Leon Osman before the Belgian added a second in stoppage timeRomelu Lukaku again proved to be West Ham's nemesis as his stoppage-time header earned Everton a dramatic 2-1 Premier League win at Upton Park.
The goal was the Belgian striker's sixth in as many appearances against the London club, but the visitors were forced to earn the points the hard way after falling behind to a 62nd-minute strike from Stewart Downing.
Leon Osman's acrobatic close-range volley got Roberto Martinez's men back on level terms within six minutes and, just as the two mid-table sides seemed destined to share the spoils, Lukaku popped up to bag his 20th goal of the season.
With both sides in contention to claim the additional Europa League place made available via the Fair Play Award, the card count was almost as relevant as the score and the hosts picked up one yellow to the visitors' four.
The result extends Everton's unbeaten league run against the London club to 14 games, with the Merseysiders climbing into the top half at the expense of Sam Allardyce's side.
The first chance of the afternoon fell Everton's way after five minutes when Osman’s 20-yard snap-shot was palmed wide by Adrian and, from the resulting corner, John Stones fired wide from close range.
In keeping with what developed into a very evenly fought first period, West Ham then responded by applying some pressure of their own and were unfortunate not to earn a penalty when Seamus Coleman appeared to handle a cross from the overlapping Aaron Cresswell.
Enner Valencia and Mark Noble were next to threaten for the hosts, while at the other end Lukaku wasted a great chance to score when he blazed wildly over from just inside the box.
Downing did at least manage to keep his rasping 32nd-minute drive on target, but Tim Howard was equal to it and, just before the break, Allardyce's side were grateful to substitute Reece Burke, whose timely challenge halted James McCarthy in his tracks as he surged into the box.
Everton continued in a similar vein at the start of the second half, Lukaku coming within inches of breaking the deadlock with a superbly struck curling free-kick, but they were then dealt a sucker-punch when Downing fired the home side in front.
Osman's response was not long in coming, however, and, having piled on the pressure in the final quarter, the visitors struck the decisive blow at the death courtesy of top scorer Lukaku.
Next up for Martinez's side is a home clash with Tottenham, while West Ham will complete their campaign by making the long trip to relegation-threatened Newcastle United.