Ten-man Arsenal twice battled back from a goal down to beat Aston Villa 3-2 with Pierre-Emerick Aubameyang's late free kick securing the points in a thriller at the Emirates on Sunday.
Arsenal ratings: Pepe, Guendouzi emerge out of unlikely win
Aubameyang completed an unlikely victory three minutes later as Arsenal became only the ninth team to win a Premier League game having had a man sent off while trailing.
It also extended his hot streak to 16 goals in his last 16 appearances across all competitions.
While victory was a welcome bonus that took Arsenal up to fourth spot, manager Unai Emery said he was disappointed with the way his side had played with 11 men on the pitch.
"When it was 11 vs. 11 we didn't control the match how we wanted because we lost a lot of balls," the Spaniard said.
"For the second half we needed to play first with the head but also with our heart. The team spirit was amazing. We need to continue working and improving things."
Arsenal's defensive weakness was exposed when Anwar El Ghazi's dangerous ball into the area was touched home by McGinn.
Arsenal were then reduced to 10 men when Maitland-Niles got a second booking after a rash sliding tackle left him and Neil Taylor in a heap.
Despite being a man down, the hosts dominated possession and got back on level terms when Pepe converted from the penalty spot for his first Arsenal goal after midfielder Matteo Guendouzi was fouled in the area by Bjorn Engels.
Chambers replied again for the hosts after Villa failed to clear their lines and Aubameyang then produced a masterful free kick to seal a remarkable win for Emery's side who moved up to fourth with 11 points, seven off leaders Liverpool.
Villa, who had a late penalty appeal for handball rejected, are third from bottom with four points after a fourth defeat in six matches.
"I am bitterly disappointed. We lost our structure for periods in the second half," Villa boss Dean Smith said.
"First half we were on the front foot and looked solid. It always going to be a tough game but we will never get a better chance to win."