Darius Vassell grabbed a second-half winner against his former club to end Manchester City's run of six straight Premiership defeats.
Albert Riera (l) challenges Aston Vila's Gareth Barry
Vassell did not get much power on his shot after turning on the edge of the six-yard box but saw it trundle home.
Villa thought they had snatched an injury-time equaliser when Kevin Phillips followed up Gareth Barry's shot - but he was flagged offside.
The defeat leaves Villa still needing a point to be safe from relegation.
Villa's recent form is almost as bad as City's, with David O'Leary's men picking up only one win in the seven games before this fixture.
That victory came in last week's derby against Birmingham - and Villa's bright start here suggested it was a start of a upturn in their fortunes.
It was City who carved out the first real chance when Sylvain Distin headed wide from Albert Riera's corner.
But Villa soon began to look the stronger side and Milan Baros was unlucky not to latch on to James Milner's through-ball with the City defence nowhere to be seen.
More chances for Villa followed with Gareth Barry scuffing his shot wide after creating space for himself in the box and Aaron Hughes going close with a driven cross that almost flew in the top corner.
Mellberg, making his return after five matches out with a hamstring injury, also tested James with a back-post header from Barry's cross.
Some dubious dribbling from James with the ball at his feet almost presented Baros and Juan-Pablo Angel with more chances - and City could consider themselves fortunate to go in level at the break.
But the visitors were a different proposition after the restart with Riera's powerful drive bringing a good stop from Thomas Sorensen and Joey Barton shooting over when well placed.
James saved well from Gabriel Agbonlahor at the other end but it was City who were on top and they broke the deadlock on 71 minutes.
Vassell was allowed to turn on Claudio Reyna's ball into the box and he got enough on his shot to beat Sorensen for his fourth goal against Villa since leaving for City in the summer of 2005.
Villa struggled to find a response but belatedly came forward in the closing stages.
Barry's shot from the edge of the area was well saved by James but Phillips followed up to slot home - only for the linesman to cut short his celebrations.
TV replays showed the decision was harsh on Villa but the result puts the pressure back on O'Leary, who has been heavily criticised by his side's fans in recent weeks.
Aston Villa manager David O'Leary on his side's disallowed goal:
"I am angry but I have to be careful what I say.
"My overall view of the game is that we did not deserve to win it but we did not deserve to get beaten either.
"It had a draw written all over it. We gave away a poor goal but then we deserved to get one back."
Manchester City manager Stuart Pearce:
"We deserved to get the three points. The players kept their nerve and we stuck at it.
"We might have got the rub of the green at the end with their offside goal but that happens in football.
"I am pleased we ended up winning the game and keeping a clean sheet because we have been under a bit of pressure."
Aston Villa: Sorensen, Mellberg, Cahill, Ridgewell (Phillips 76), Hughes, McCann, Barry, Samuel, Milner, Angel, Baros (Agbonlahor 58).
Subs Not Used: Taylor, Bouma, Gardner.
Man City: James, Sommeil, Richards, Dunne, Distin, Sinclair, Reyna, Barton, Riera (Musampa 90), Samaras (Sibierski 45), Vassell (Jihai 87).
Subs Not Used: Weaver, Flood.
Goals: Vassell 71.
Ref: C Foy (Merseyside).