The Hammers had taken the lead inside two minutes with a strike from Robbie Keane but Villa levelled with a Darren Bent header shortly before the interval.
West Ham goalkeeper Robert Green pulled off a string of top-class saves to keep his side in the game but Villa snatched a deserved victory with a header from substitute Agbonlahor in added time.
West Ham had promised a "traditional street party atmosphere" and the home faithful were waving their claret and blue pennants inside two minutes after Keane opened the scoring. Gary O'Neil's blocked shot fell to Thomas Hitzlsperger, who lofted a header towards Keane on the edge of the six-yard box and he turned to fire past Brad Friedel.
The leveller came when Mark Noble was caught in possession inside the West Ham box and Villa pounced, Luke Young crossing for Bent to head home.
The visitors were only denied the lead by two magnificent saves in quick succession from Green in the West Ham goal, keeping out efforts from Bent and Ashley Young. But the winner came in the first minute of injury time, Ashley Young finding space down the right and picking out substitute Agbonlahor to head home the winner.
Source: PA
Source: PA