Allardyce has come under fire after the London club's run of seven Premier League games without a win and humiliating FA Cup and League Cup thrashings against Nottingham Forest and Manchester City respectively in the last week.
But Carlton Cole scored shortly before half-time at the Cardiff City Stadium on Saturday, before Mark Noble sealed the points in second-half stoppage time to ensure Cardiff replace Allardyce's men in the bottom three on goal difference.
West Ham had to dig deep for the victory as James Tomkins was sent off for a second bookable offence 18 minutes from time, and they also lost Guy Demel to what appeared to be a serious injury in the first half.
They were not to be denied three precious points, though, and Andy Carroll also made his first appearance of the season as a second-half substitute, the striker setting up Noble's goal as Ole Gunnar Solskjaer was beaten in his first home game in charge of Cardiff.
Record-signing Carroll was named in the West Ham squad for the first time since his close-season switch from Liverpool, while Allardyce made five changes to the side that was hammered at City in midweek.
Cardiff centre-back Mark Hudson made his first Premier League start, and new signing Magnus Wolff Eikrem was on the bench as Solskjaer also made five alterations to his starting line-up.
West Ham started brightly and Cardiff breathed a sigh of relief when Stewart Downing's fourth-minute cross from the right evaded everyone and struck the far post, before David Marshall denied Tomkins from the rebound.
Demel then became West Ham's latest injury victim when he was caught in the face by team-mate Roger Johnson's elbow after only seven minutes and was carried off wearing a neck brace following a lengthy stoppage.
Cardiff came tantalisingly close to opening the scoring after 31 minutes, when Kim Bo-Kyung’s shot deflected over Adrian and struck the crossbar before bouncing down on the line before Frazier Campbell fouled the goalkeeper following up.
The visitors made the most of that fortune 11 minutes later, as Matt Jarvis picked out Cole with a precise ball across the face of the goal and the striker made no mistake from six yards out.
Cardiff were almost caught out again a minute later, but Matt Taylor's right-foot effort whistled just past the far post.
The home side thought they should have had a penalty during 10 minutes of added time when Craig Noone went down under a George McCartney challenge, but referee Lee Mason waved play on.
Craig Bellamy made his return from injury when he replaced Peter Odemwingie at the break and the evergreen forward wasted no time in making an impact, as he swung in a free-kick that was headed over the bar by an unmarked Hudson.
Cardiff piled on the pressure and Adrian produced a fine reflex save to deny the lively Campbell 12 minutes into the second half after an inviting cutback from Bellamy.
Norway midfielder Eikrem came on to make his debut after 64 minutes and Bellamy curled a free-kick just wide six minutes later as the hosts' frustration grew.
Carroll replaced Cole a minute later to warm applause from the travelling fans, but West Ham were reduced to 10 men when Tomkins was shown a second yellow card for a high challenge on Campbell in the 72nd minute.
However, the visitors stood firm and Noble sealed the points in stoppage time when he drilled the ball into the far corner after being played in by Carroll.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.