CARDIFF, Wales (AP) — West Ham ended its miserable run by beating Cardiff 2-0 on Saturday to climb out of the relegation zone and hand Ole Gunnar Solskjaer a disappointing loss in his first Premier League game in charge.

Carlton Cole put West Ham ahead in the 42nd minute and the London club hung on with 10 men after James Tomkins was given a second yellow card in the 72nd before Mark Noble secured the victory on a counter attack in injury time.

The win eases the pressure on manager Sam Allardyce following a 5-0 loss to second-tier club Nottingham Forest in the FA Cup and a 6-0 drubbing against Manchester City in the first leg of their League Cup semifinal.

In a further boost, Andy Carroll made his season debut after a foot injury as he came off the bench in the 72nd and helped set up the second goal.

For Solskjaer, however, the game highlighted the challenge he faces in turning things around at Cardiff, which fell below West Ham into the relegation zone.

Fraizer Campbell, Craig Noone and Mark Hudson all failed to convert good chances for the hosts, who dominated for long stretches in the second half.

West Ham hit the woodwork inside three minutes, as Stewart Downing's cross missed everyone and cannoned out of the far post, where Tomkins' follow-up was smothered by David Marshall.

Cardiff looked the more likely to score after that and they thought they had in the 32nd minute.

Kim Bo-kyung's shot deflected off Roger Johnson, struck the bar and appeared to cross the line as it came down. But replays showed the Goal Decision System had been correct, with the ball landing on the line.

The visitors opened the scoring when Matt Taylor picked out Matt Jarvis, and the winger's weighted pass gave Cole an easy tap in.

That prompted Solskjaer to hand fit-again Craig Bellamy a first appearance since Nov. 9 in place of Peter Odemwingie. It nearly paid immediate dividends as the veteran's free kick found an unmarked Hudson, who headed over.

West Ham was pegged further back when Tomkins picked up a second booking for a foul on Campbell after earlier being cautioned needlessly for dissent.

But West Ham survived and Noble finished a sweeping break from Carroll's pass to secure the win.