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.
DID YOU KNOW?
Before this game, Cardiff had lost their last four trips to West Ham without scoring and had not won at Upton Park since April 1950
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.
Full Time The final whistle is blown by the referee.
Rudy Gestede provided the assist for the goal.
90:00 +0:14 Goal scored
Goal - Kenny Miller - West Ham 0 - 1 Cardiff Kenny Miller gets on the score sheet with a goal from inside the box to the top left corner of the goal. West Ham 0-1 Cardiff.
Shot from outside the area by Peter Whittingham misses to the left of the goal.
Pablo Barrera takes a shot. David Marshall makes a save.
Rudy Gestede takes a shot. Robert Green makes a save.
Short corner taken by Peter Whittingham from the right by-line.
Scott Parker gives away a free kick for an unfair challenge on Peter Whittingham. The free kick is delivered left-footed by Peter Whittingham from right wing, clearance made by Carlton Cole. Inswinging corner taken right-footed by Don Cowie from the left by-line to the near post, clearance made by Joey O'Brien.
Free kick awarded for a foul by Carlton Cole on Mark Hudson. Direct free kick taken by David Marshall.
Rudy Gestede gives away a free kick for an unfair challenge on Herita Ilunga. Direct free kick taken by Robert Green.
The assistant referee signals for offside against Carlton Cole. David Marshall takes the indirect free kick.
Substitution Pablo Barrera comes on in place of Freddie Sears.
Inswinging corner taken right-footed by Freddie Sears, James Tomkins takes a shot. Peter Whittingham manages to make a clearance. Scott Parker takes a shot from just outside the penalty area which clears the crossbar.
Joe Mason is penalised for a handball. Direct free kick taken by Robert Green.
Free kick crossed left-footed by Matthew Taylor, Peter Whittingham makes a clearance.
Booking Anthony Gerrard shown a yellow card.
Anthony Gerrard gives away a free kick for an unfair challenge on Carlton Cole.
Substitution Joe Mason replaces Craig Conway.
Substitution Carlton Cole on for Frederic Piquionne.
Substitution Mark Noble leaves the field to be replaced by Jack Collison.
Kenny Miller produces a right-footed shot from inside the area that clears the bar.
James Tomkins takes a shot. Save by David Marshall. Corner from right by-line taken by Freddie Sears.
Matthew Taylor takes a outswinging corner to the near post, Peter Whittingham makes a clearance.
Header from close in by Rudy Gestede misses to the left of the goal.
Kevin Nolan challenges Craig Conway unfairly and gives away a free kick. Don Cowie restarts play with the free kick.
Substitution Rudy Gestede on for Robert Earnshaw.
Robert Earnshaw has an effort at goal from outside the penalty box missing to the wide right of the target.
Close range shot by Frederic Piquionne strikes the post.
The offside flag is raised against Scott Parker. David Marshall takes the indirect free kick.
Frederic Piquionne takes a shot. Blocked by Mark Hudson.
Matthew Taylor takes a shot. David Marshall makes a save. Corner taken by Matthew Taylor played to the near post, Kevin McNaughton makes a clearance.
Frederic Piquionne takes a shot. Comfortable save by David Marshall.
The offside flag is raised against Frederic Piquionne. Free kick taken by Anthony Gerrard.
Headed effort from the edge of the area by Robert Earnshaw goes wide of the right-hand upright.
Unfair challenge on Mark Hudson by Frederic Piquionne results in a free kick. David Marshall restarts play with the free kick.
Winston Reid concedes a free kick for a foul on Peter Whittingham. Shot comes in from Peter Whittingham from the free kick.
Outswinging corner taken from the right by-line by Freddie Sears, Aron Gunnarsson makes a clearance.
The referee blows his whistle to start the second half.
45:00 +1:34 Half time
Half Time It is the end of the first-half.
Kenny Miller is ruled offside. James Tomkins takes the free kick.
The offside flag is raised against Robert Earnshaw. Robert Green restarts play with the free kick.
Foul by James Tomkins on Peter Whittingham, free kick awarded. Direct free kick taken by Don Cowie.
Corner taken by Freddie Sears from the left by-line, save by David Marshall.
James Tomkins concedes a free kick for a foul on Kenny Miller. Don Cowie restarts play with the free kick. Robert Earnshaw takes a shot. Scott Parker is penalised for handball and concedes a free kick. Peter Whittingham shoots direct from the free kick, save by Robert Green. Corner taken left-footed by Don Cowie from the right by-line to the near post, clearance made by Frederic Piquionne.
Frederic Piquionne takes a shot. Save made by David Marshall.
The offside flag is raised against Robert Earnshaw. Free kick taken by James Tomkins.
Inswinging corner taken left-footed by Matthew Taylor from the right by-line to the near post, clearance made by Don Cowie. Corner taken by Matthew Taylor.
Foul by Mark Noble on Aron Gunnarsson, free kick awarded. Kevin McNaughton restarts play with the free kick.
Corner taken short by Don Cowie.
Free kick awarded for an unfair challenge on Kevin McNaughton by Matthew Taylor. Direct free kick taken by Don Cowie.
Shot from just outside the box by Kevin Nolan goes over the crossbar.
Free kick awarded for an unfair challenge on Winston Reid by Kenny Miller. Free kick taken by Robert Green.
Free kick awarded for a foul by Peter Whittingham on Joey O'Brien. The free kick is swung in left-footed by Matthew Taylor, Anthony Gerrard makes a clearance.
Don Cowie takes a shot. Robert Green makes a fantastic save. Outswinging corner taken by Don Cowie, Aron Gunnarsson produces a header from inside the area that goes over the bar.
The assistant referee signals for offside against Robert Earnshaw. Indirect free kick taken by Robert Green.
Shot by Freddie Sears from inside the six-yard box clear the bar.
Kevin Nolan has a headed effort from close in and clears the bar.
Anthony Gerrard challenges Freddie Sears unfairly and gives away a free kick. Shot comes in from Matthew Taylor from the free kick, David Marshall makes a save. Inswinging corner taken by Matthew Taylor from the right by-line, Mark Hudson makes a clearance.
The referee blows for offside. Robert Green takes the indirect free kick.
Foul by Kevin Nolan on Anthony Gerrard, free kick awarded. David Marshall takes the direct free kick.
Free kick awarded for a foul by Robert Earnshaw on Mark Noble. Direct free kick taken by Winston Reid.
Frederic Piquionne takes a shot. Save made by David Marshall. Corner taken left-footed by Matthew Taylor from the right by-line to the near post, save by David Marshall. Mark Noble produces a right-footed shot from the edge of the area and misses to the left of the goal.
Unfair challenge on Kevin McNaughton by Matthew Taylor results in a free kick. Don Cowie takes the free kick.
Corner taken left-footed by Matthew Taylor. Frederic Piquionne challenges Mark Hudson unfairly and gives away a free kick. David Marshall takes the direct free kick.
Effort on goal by Robert Earnshaw from just inside the area clears the crossbar.
The game kicks-off.
Live text and data provided by The Press Association
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.