Pierre-Emerick Aubameyang again proved to be Arsenal's saviour as his late free-kick earned the 10-man Gunners a hard-fought victory over Aston Villa.
Dean Smith's visitors had twice led at the Emirates Stadium only to fall to a 3-2 defeat as Aubameyang struck with six minutes remaining.
John McGinn had given Villa a surprise lead but, despite Ainsley Maitland-Niles' dismissal late in the first half, club-record signing Nicolas Pepe equalised from the penalty spot.
Villa stunned the home crowd once more as they regained the lead just 89 seconds later, Wesley turning home, only for Callum Chambers to hit his first Arsenal goal since August 2016 and Aubameyang to provide the winning moment to take Unai Emery's side into the Premier League top four.
Maitland-Niles passed up a fine early opportunity as he was picked out inside the box but could only send his strike high over Tom Heaton's crossbar.
As with most of Arsenal's games this season, the start of the match was wide open. Bernd Leno was tested twice by long-range McGinn efforts, the second of which was well saved by the Germany international.
Pepe, who Emery concedes still needs time to adapt following his summer transfer, started in lively fashion and had a shot deflected behind - with Aubameyang drawing a low stop out of Heaton following a short routine from the resulting corner.
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, the 18-year-old making his full Premier League debut, was one bright spark for the hosts in the opening stages, 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 half-time for a second bookable offence.
Having already been cautioned for bringing down El Ghazi early on, referee Jon Moss produced another yellow as he followed through to foul Neil Taylor - receiving treatment on the floor before being red-carded.
Emery introduced Chambers for Saka at the interval but it was a Villa mistake which would present them with a way back into the contest.
Guendouzi bundled his way into the penalty area and was tripped by Bjorn Engels, Pepe picking up the ball and slamming the resulting spot-kick 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 counter-attack but his shot was straight at Leno, while a David Luiz free-kick was tipped over by Heaton at the other end.
Guendouzi's drive hit the base of Heaton's post moments later as the 10 men chased a second equaliser of the afternoon.
Aubameyang ballooned over the bar but Emery's side then equalised for a second time as Chambers stabbed home 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 and the Gabon striker, wearing the captain's armband after Granit Xhaka was taken off, fired in his seventh of the season from the free-kick.
Villa pushed on in the closing stages in the search for an equaliser but Arsenal's depleted ranks held firm to secure the three points.