Zamora headed past Carroll under very little pressure
Relegated Derby are still without a win under manager Paul Jewell as West Ham luckily found victory at Upton Park.
A weak Dean Leacock challenge allowed Hammers striker Bobby Zamora to nod home on 25 minutes but Derby, showing rare creative intent, hit back.
Tyrone Mears powered a fine equaliser over Robert Green on 65 minutes and the Rams were looking likely winners.
But substitute Carlton Cole cushioned in a close-range volley 10 minutes later to leave the visitors desolate.
With just one win all campaign, morale-sapped Derby face the prospect of becoming the first club in English league football for 109 years with such a low total of victories.
West Ham have faded of late and, with next season in mind, manager Alan Curbishley made seven changes, handing 18-year-old striker Freddie Sears and James Tomkins, 19, their first Premier League starts.
Interview: West Ham boss Alan Curbishley
Somewhat predictably, the game started scrappily.
Rams midfielder David Jones took a ball flush in the face to cause a delay and limp-footed West Ham keeper Green nearly allowed the ball to creep into his own goal before hoofing clear.
But the home side slowly worked their way into it, with Sears a lively focal point in attack.
When the goal came it was depressingly simple from a Derby perspective, with George McCartney floating over a free-kick for Zamora to head home with little resistance from challenging defender Leacock.
Such was Jewell's anger with Leacock he sent substitute Darren Moore out to warm up immediately, though he resisted making a change after an incident which summed up Derby's woeful season.
Interview: Derby boss Paul Jewell
But the Rams did hit back.
A flash of excellent link-up play from Jones and Mile Sterjovski let Mears in down the right and after Jones's deflected shot, Kenny Miller hooked just over the bar from the resulting corner.
Captain Robbie Savage then went close with a flying header which Green did well to tip over the bar just before half-time.
The Rams came quickly out of the blocks after the break with Jones flashing a wicked low cross across the six-yard box which Sterjovski and Miller just failed to connect with.
Derby continued to look creative in possession with Miller impressive and Savage, roundly booed throughout, in the thick of the action.
With West Ham on the back foot, Sterjovski played Mears in on 65 minutes and Green had to be alert to smother at the Derby man's feet as he charged in on goal.
But Derby made the breakthrough they deserved minutes later, catching West Ham on the counter attack.
Hossam Ghaly sent Mears through again and lifted a powerful finish over Green from 18 yards.
With the game now alive and both sides playing open football, Derby looked the most likely to get another goal.
But Curbishley brought Sears off for Cole, who converted Freddie Ljungberg's cross from six yards out after the Swede's slick exchange of passes with Mark Noble had carved Derby open down the left.
Savage headed over from a decent chance in stoppage time and Derby now need five points from their remaining three matches to ensure their season is not the most unsuccessful Premier League campaign ever.
West Ham manager Alan Curbishley:
"After losing our last three games it was important that we bounced back. There is a great lack of appreciation of what we have done this season.
"We have managed to keep away from the danger area. On Friday morning we were scratching our heads to see how we would put a team together.
"The players have done really well and looking back this has been a successful season."
Derby boss Paul Jewell:
"The fans have been unbelieveable and that's why we were desperate to reward them today.
"They have been there all season and they deserve to be in the Premier League.
"We hope to take them back there next season."
West Ham: Green, Pantsil, Tomkins, Neill, McCartney, Faubert (Solano 78), Noble, Parker, Ljungberg (Boa Morte 90), Sears (Cole 74), Zamora. Subs Not Used: Walker, Mullins.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.