Charles N'Zogbia has not done a lot to make Aston Villa feel that the £9.5m they paid for him was money well spent but his contribution to his side's victory over West Ham could turn out to be priceless. Here was what Villa thought they were getting when the French winger arrived from Wigan Athletic two summers ago. Here was the form that once made him one of the most coveted players in England, one who would not look out of place in a side challenging at the top of the table.

Instead N'Zogbia is at Villa, who are in a desperate battle to avoid relegation. Paul Lambert's side came into this match with no wins in their last eight in the league and for much of a largely dismal contest it looked like that run would be extended. N'Zogbia had other ideas. With 16 minutes remaining, he earned a penalty that allowed Christian Benteke to give Villa the lead and then, four minutes later, he curled a brilliant free-kick past Jussi Jaaskelainen. The victory moved Villa out of the bottom three, one point above Reading.

The win was not without complications for Villa, who have made a habit of throwing away leads from seemingly impregnable positions all season, and they were also grateful for two saves from Brad Guzan in stoppage time as Kevin Nolan and Carlton Cole threatened to snatch a point for West Ham.

"I think that will be a huge thing for us," said Lambert, who was delighted his side held on after Ashley Westwood's own goal prompted an anxious finish. "We've been in positions where we've been a couple of goals up and if we took more points from that we'd be sitting in mid-table."

For West Ham, this was another depressing away game and Sam Allardyce admitted there is too much reliance on their solidity at Upton Park. They have lost their last five matches on their travels and although they dominated the second half, there were times when they might have been more comfortable if the referee, Mark Clattenburg, had given them an oval-shaped ball to play with instead of a round one.

West Ham, who gave a first start to Emanuel Pogatetz in defence, began in an unfamiliar 5-3-2 formation and were poor in the first half. Villa, whose preparations were disrupted by Gabriel Agbonlahor falling ill in the morning, should have led at the break but when Benteke's tame shot from the edge of the area was spilled by Jaaskelainen, the usually clinical Andreas Weimann somehow steered the rebound wide.

Recognising how dire his side had been, Allardyce reverted to a four-man defence after the break. Suddenly the complexion had changed and Darren Bent, just on as substitute, had to clear a shot off the line midway through the second half when a corner fell to Andy Carroll. "The disappointing thing for me was we shouldn't have even been in the position to have to save [the game] the way we've played in the second half," Allardyce said.

Yet Villa carried a threat on the break. Shortly after sending a swerving drive inches wide from the right, N'Zogbia darted into the area from a similar position, Mark Noble lazily hung out a leg and Clattenburg pointed to the spot. Benteke coolly sent Jaaskelainen the wrong way. It got even better for Villa when N'Zogbia's expert free-kick from 25 yards flew into the top-right corner with the goalkeeper rooted to the spot. "The free-kick was world class," Lambert said. "He's got that in his make-up. He's a very talented footballer."

Villa's fans knew better than to relax though. Ricardo Vaz Tê twice went close and panic set in when Westwood inadvertently glanced Joe Cole's cross past Guzan with three minutes remaining. No one would have been surprised if an equaliser had followed and, as an increasingly agitated crowd howled for the final whistle, Nolan's low shot was turned behind by Guzan in the fourth minute of added time. The corner came in, Cole headed goalwards and Guzan pushed the ball over. It was the final touch of the match and, at last, the Holte End could celebrate.