Arsenal heart and commitment was questioned after blowing a two-goal lead to draw at Watford last weekend.
But they showed no little spirit as Calum Chambers looped home an equaliser before Aubameyang took centre stage to rifle home a free-kick from the edge of the area.
A vital three points, which lifts Arsenal up to fourth, is a huge boost for Emery, who has faced questions in recent weeks over his ability to lead the Gunners back to the Champions League next season.
The Spaniard still has to find the right balance in midfield to protect an ailing defence, but with Aubameyang and Pepe in attack, Arsenal always look capable of scoring.
Maitland-Niles’s nightmare afternoon began after barely a minute when he blazed over Arsenal’s best chance of the first half.
The right-back then dragged down Anwar El Ghazi for an early booking that was to prove costly.
McGinn was a constant threat to the Arsenal defence as the Scottish international twice tested Bernd Leno from outside the box.
However, the hosts did not heed those warning shots as McGinn was allowed to ghost in at the far post to turn home El Ghazi’s cross on 20 minutes.
Maitland-Niles then naively dived into a sliding challenge with Neil Taylor and saw a second yellow.
Emery sacrificed 18-year-old Buyako Saka on his first Premier League start for Chambers to fill the void at right-back.
And the hosts were handed a lifeline just before the hour mark when Matteo Guendouzi was bundled over in the box by Bjorn Engels.
Aubameyang stood aside to let Pepe net his first goal since joining Arsenal for a £72 million ($87 million) club-record move from Lille.
But Arsenal’s joy did not last long as their leaky defence was breached easily once more.
Jack Grealish galloped freely through the midfield before squaring for Wesley to prod in at the near post.
Arsenal almost responded once more as Tom Heaton turned Guendouzi’s long-range drive onto the post.
Heaton also tipped over David Luiz’s dipping free-kick, while Aubameyang could not turn Sokratis Papastathopoulos’s knockdown on target.
However, Chambers was in the right place nine minutes from time to score his first Arsenal goal since 2016.
In a topsy-turvy start to the season, Aubameyang has been the man Arsenal can rely on and he stepped forward again to win the game with his seventh goal of the season by drilling a free-kick he won beyond the unsighted Heaton.