The Hammers played some of their most scintillating football of the season, though at one stage it looked like they would have to settle for a point - which would have been, but for the Upton Park floodlights being on, daylight robbery!
Paul Furlong had an excellent chance to score early on when set up by Jamie Cureton, but he shot tamely at Steve Bywater.
Marlon Harewood then outhustled Danny Shittu only for his acutely angled shot to be parried by Chris Day; Carl Fletcher's follow-up was headed off the line by Frankie Simek.
Fletcher set up Matthew Etherington, whose firm shot was parried by Day, while at the other end Mark Bircham shot well over.
A shaven-headed Tomas Repka was booked for a tackle from behind on Tony Thorpe in the midfield, and soon after he limped off to be replaced by Gareth Ainsworth.
West Ham, inspired by Don Hutchison, were playing some crisp passing movements, and with one such Steve Lomas chipped deftly to set Hutchison up; he cut inside his man, only to steer his curling shot just wide.
The move came shortly after a scramble in which Mullins and Chadwick both had shots blocked by defenders, the latter chance at the expense of a corner.
But West Ham didn't have to wait too much longer to take the lead; Chadwick burst into the QPR box to be felled by Shittu; after QPR's fractious protestations, Marlon Harewood slipped the penalty home - it was no more than the Hammers deserved.
Hutchison was booked for a foul on Simek, while Simek himself was yellow carded for a scything tackle on Etherington.
Harewood, after collecting a pass from Chadwick, had what looked like a valid claim for a penalty turned down when he hit the deck following a challenge by Simek; he was furious at the decision not to award him a spot kick.
After the break he half-volleyed just over following a corner, before being denied a less strong claim for a penalty when he was brushed over on the edge of the box.
West Ham were still on top, but Kevin Gallen nearly grabbed a goal against the run of play with a superb half volley that Steve Bywater acrobatically tipped away for a corner.
But they did score when substitute Kevin McLeod stole in at the far post, following Georges Santos's flick on of Mark Bircham's throw-in from QPR's right, to volley home from two yards - and delight, if not astound, the 2,715 visiting fans.
Chris Powell shot just wide before Bobby Zamora replaced Luke Chadwick.
Marlon got the goal in open play that his performance merited when he blasted home a venomous first time shot when QPR failed to clear a cross from the left by Chris Powell and Zamora cleverly dummied.
It was just reward for Marlon, who had led the way all afternoon by chasing anything and everything.
With the minutes ticking away, Don Hutchison, who had replaced Bobby Zamora in the starting line-up, went off to great applause and was replaced by Anton Ferdinand.
Chris Powell, who came in to the team for Rufus Brevett, was booked late on.
TEAM: Bywater, Repka, Hutchison [Ferdinand], Fletcher, Harewood, Lomas, Etherington, Mullins, Davenport, Chadwick [Zamora], Powell.
Subs unused: Walker, Brevett, Rebrov.