The Villans fought back from two goals down to draw level, only for the Brazilian to net a late volley and open up a nine-point gap between the hosts and fifth-placed Liverpool
Manuel Pellegrini's soon-to-be-deposed champions appeared to be cruising to back-to-back wins for the first time since February after Sergio Aguero and Aleksandar Kolarov put them 2-0 up.
Tom Cleverley’s first Villa goal reduced the arrears in the 68th minute and Carlos Sanchez coolly volleyed home from a corner with five minutes remaining.
But Tim Sherwood's team, who reached the FA Cup final in similarly rousing fashion by beating Liverpool last weekend, displayed set-piece frailties of their own in the 89th minute as Fernandinho snatched the points.
The win moves under-fire City boss Pellegrini and his team back up to second in the table, although Arsenal and Manchester United both have the chance to go back above them when they play on Sunday.
Villa are two points above the relegation zone in 16th following wins for fellow strugglers Hull City and Leicester City earlier on Saturday and they have played a game more than the three teams immediately below them.
It was a sluggish start from the away side, who had Jores Okore and Sanchez back in their line-up against an unchanged City, before goalkeeper Brad Guzan had a moment to forget.
The United States international, who had conceded nine times across his previous two visits to the Etihad Stadium, scuffed a clearance back towards his goalmouth to leave Aguero with the simplest of finishes to open the scoring.
Villa full-back Kieran Richardson made a vital last-ditch challenge when Jesus Navas raced onto Yaya Toure's lofted pass and the City captain volleyed wide when the resulting corner was only partially cleared.
Guzan misjudged Kolarov's 16th-minute free-kick, Fernando heading wide of an unguarded net, before an error-strewn Villa spell continued when Leandro Bacuna's ill-advised backpass almost let Aguero in for a second.
Christian Benteke should have equalised amid strong suspicions of offside in the 27th minute but City goalkeeper Joe Hart spread himself to save.
Toure appeared to be troubled by a hamstring problem as half-time approached and he was replaced by Fernandinho for the second period.
Aguero had a 52nd-minute penalty appeal rejected when he was pulled over by Bacuna as Navas cut a ball back across the penalty area, while Villa again tested referee Mike Dean when Okore dived into a challenge on David Silva inside his own box.
Sanchez brought down Fernandinho as City's attacks continued, and, after 66 minutes, Kolarov curled the resulting free-kick between Richardson and Bacuna in the Villa wall to find the bottom corner of the net.
City's two-goal advantage was short-lived when, two minutes later, Hart dashed out for a Jack Grealish set-piece that Fernandinho half cleared and Cleverley fired beyond the goalkeeper.
And the travelling support were sent into raptures when Hart was unable punch the ball clear in a crowded area and Sanchez equalised.
A marginal offside flag stalled Benteke as he stormed forward in search of an improbable win and then, with just a minute left, Villa's frustration was compounded as Fernandinho chested down and fired home from close range.