Villa regained the lead just 89 seconds later, with Wesley turning home, but Calum Chambers hit his first Arsenal goal since August 2016 to level again in the 81st. Aubameyang's winner sent Unai Emery's side to fourth place.
As with most of Arsenal's games this season, the start of the match was wide open. Goalkeeper Bernd Leno was tested twice by long-range McGinn efforts, the second of which was well saved. Pepe, who Emery concedes still needs time to adapt following his summer transfer, started in lively fashion and had a shot deflected behind.
Moments later, the visitors were ahead following more suspect defending from Arsenal. Anwar El Ghazi crossed and McGinn, who had already lost Matteo Guendouzi, ghosted in between three static Arsenal defenders to steer the ball home.
Bukayo Saka, making his full Premier League debut at 18, was one bright spark for hosts Arsenal in the opening stages, with the winger keen for possession and striking just over the bar from outside the box.
Arsenal's afternoon only looked to be heading in one direction when Maitland-Niles was sent off four minutes before halftime for a second bookable offence. Having already been cautioned for bringing down El Ghazi early on, referee Jon Moss produced another yellow for the player as he followed through to foul Neil Taylor — receiving treatment on the floor before being red-carded.
A Villa mistake presented Arsenal with a way back into the contest in the second half. Guendouzi bundled his way into the penalty area and was tripped by Bjorn Engels. Pepe sent the resulting penalty down the middle to level.
But Villa responded immediately, first McGinn flashing a shot wide before Jack Grealish broke into the box past Sokratis Papastathopoulos and crossed for Wesley to finish at the near post. Trezeguet should have done better as Villa caught Arsenal on the counterattack but his shot was straight at Leno, while David Luiz's free kick was tipped over by Villa goalkeeper Tom Heaton at the other end.
Guendouzi's drive hit the base of Heaton's post moments later as the 10 men chased a second equalizer. Aubameyang ballooned over the bar but Emery's side then leveled for a second time as Chambers struck from six yards at the second attempt.
The comeback was complete less than three minutes later as Engels fouled Aubameyang on the edge of the box. The Gabon striker, wearing the captain's armband after Granit Xhaka was taken off, netted his seventh of the season from the free kick.
More AP soccer: https://apnews.com/apf-Soccer and https://twitter.com/AP_Sports