Kevin Keen's team, who had already hit 10 goals in their first three matches this season, were trailing 3-2 with just over 15 minutes remaining when an amazing late surge saw them run out emphatic winners.
Villa had made the stronger start and took the lead early on, but Bobby Singh levelled from the penalty spot on the stroke of half-time after Hogan Ephrain had been fouled.
The visitors restored their advantage early in the second half, before Hammers equalised again when Ryan Andrews fired home a superb goal.
Goalkeeper Darren Behcet then saved a Villa penalty, only for an opposing striker to knock in the rebound and give his side the lead for a third time.
Then came the fightback. Substitute Denzil Davidson bought Hammers level yet again with his first touch after coming on, before Sos Yao hit a quick double and Ishmael Welsh completed the rout late on. In between, Villa had a man sent off to make it an eventful morning for the youngsters.
Said Kevin Keen afterwards: "It was a bit surreal in the second half, but we produced a good attacking performance after they had outplayed us early on."
Team: Behcet, Young, White, Norval, Andrews, Yao, Cowley (Welsh 45), Singh (Cumberworth 70), Brady, Allen (Davidson 73), Ephrain. Subs unused: Kemal, Tomkins.
Meanwhile, Darren Blewitt's goal was only a consolation for Tony Carr's under-19s, who went down 2-1 at Leicester City, leaving them still searching for a first win of the season.