Stewart Downing’s strike was cancelled out by Leon Osman before Lukaku extended his remarkable record against the Hammers by converting from close range.
The Belgium striker has scored six times in six games for Everton against West Ham, four in four this season, and the goal took the visitors level with their hosts on points in 10th place.
There was scarcely a mention of Allardyce, although one ‘Big Sam Out’ banner was unfurled at the end of the game.
It could be that next Sunday’s match at his former club Newcastle is Allardyce’s last as Hammers boss, with his contract set to expire and talks on hold until the end of the season.
The first half was so quiet that interval thoughts turned to the sides’ chances of qualifying for the Europa League through the fair play standings.
West Ham were ahead in that respect: referee Kevin Friend showed the hosts one yellow card to Everton’s two. The full-time score in yellows was: West Ham 1 Everton 4.
Thankfully there were goals in the second half, with one moment of quality apiece.
Downing exchanged passes with Alex Song before a clinical finish, and six minutes later Osman converted on the turn to equalise.
Then came Lukaku’s decisive intervention, heading in substitute Aiden McGeady’s cross.
West Ham, who made three changes following the loss at Aston Villa, with Winston Reid, Song and Carlton Cole coming in, allowed Everton in for the first opportunity after four minutes.
Ross Barkley found Osman, whose shot from the edge of the area was turned around the post by Adrian, the goalkeeper whose penalty shoot-out heroics ended Everton’s FA Cup participation in January.
The Hammers did not test 19-year-old left-back Brendan Galloway, who was making his Everton debut, early on, but did come close down their own left.
Twice crosses from the flank resulted in penalty appeals, with James McCarthy blocking Mark Noble’s cross with his chest and Seamus Coleman adjudged to have done the same in dealing with an Aaron Cresswell centre.
James Collins was replaced by Reece Burke after 14 minutes due to an apparent hamstring problem, leaving Allardyce to bemoan the Hammers’ injury luck once more.
Noble, skipper in the absence of Kevin Nolan due to a family bereavement, fired wide across Tim Howard’s goal.
Reid body checked Lukaku to earn a booking and Coleman followed for holding back Enner Valencia soon after.
Howard parried a Stewart Downing strike and Gareth Barry was booked for a tackle from behind on Reid.
There was a greater intensity from both teams in the second half.
Lukaku curled a free-kick narrowly wide before Downing’s incisive move.
The former Liverpool winger received a return pass from Song, cut inside Galloway and found the bottom corner across goal.
The lead lasted barely six minutes.
Lukaku crossed to Osman, who, with his back to goal, took one touch before volleying the ball in.
Barkley missed a fine chance from close range, scooping the ball over, in his last act before he was replaced by Kevin Mirallas.
McCarthy was booked for a foul on Noble, much to the approval of home fans eyeing a continental excursion in July.
Adrian saved from Lukaku and next McGeady’s shot was blocked by Reid before Galloway became the fourth Everton player booked, for impeding Cheikhou Kouyate.
That brought a further cheer, but the Hammers had failed to heed the warnings and Lukaku lost Burke to clinch victory.