Cardiff City's Kenny Miller scored a 91st-minute winner to ensure a losing start for Sam Allardyce's West Ham in the Championship.
The Hammers, favourites for promotion, controlled the game for long periods but paid the price after squandering a number of chances in front of goal.
Frederic Piquionne came closest to scoring when he hit the post from Matt Taylor's superb low cross.
But Miller's turn-and-shot a minute into added time secured the points.
West Ham's midfield quintet of Kevin Nolan, Scott Parker, Mark Noble, Freddie Sears and Taylor - arguably the strongest midfield in the Championship - linked well and crafted plenty of chances early on.
With Cardiff firmly on the back foot, Parker, Nolan and Piquionne each came close to rewarding West Ham for their early dominance.
But the Bluebirds, under the management of Malky Mackay for the first time, grew in confidence the longer they kept West Ham at bay and Rob Green was forced into a smart save low to his left when Don Cowie stole a yard and nodded towards goal from six yards.
Green was called into action again as Peter Whittingham drew another agile save from the former England number one, with a stinging low effort from a free-kick late in the first half.
A revitalised West Ham tightened their grip on the game in the second half, with Taylor emerging as their key attacking threat.
Taylor's searing run down the left wing left Kevin McNaughton in his wake before his fizzing low cross found Piquionne, who could only steer his first-time shot on to the post.
Cardiff defenders Mark Hudson and Anthony Gerrard put their bodies on the line on more than one occasion as the Cardiff rearguard held firm in the face of incessant second-half pressure.
West Ham defender James Tomkins saw his late header cleared off the line as the game appeared to be edging towards a draw.
But Miller, one of nine new signings made by Cardiff over the summer, secured a shock win for the visitors when he collected a pull-back from substitute Rudy Gestede and lashed the ball past Green, who got a hand to it.
Boos rang out from home fans at full-time as West Ham remain without a league win since beating Stoke on 5 March.