Arsenal had just 27% of the ball but somehow beat the best team in Europe right now.
It’s not clear whether Olivier Giroud used his hand or his face for the Gunners’ opener but frankly, Arsenal will not care.
The Frenchman came off the bench to bundle home a Santi Cazorla free-kick after Manuel Neuer made a massive misjudgement.
Neuer had kept the German side in the game thanks to a phenomenal save to deny Theo Walcott.
Bayern – unbeaten this season before their visit to the Emirates – dominated possession but came up against stern opposition from the impeccable Petr Cech and a sturdy Arsenal defence.
The Gunners added a second late in the game through Mesut Ozil, despite Neuer’s acrobatic attempt to keep out his fellow German.
Arsenal, though, still have it all to do to qualify for the knockout stages, and next travel to Munich in November.
Bayern supporters held a protest at ticket prices for the opening five minutes – the slogans declaring ‘without fans football is not worth a penny’ – and were applauded from the home ends when they eventually took their seats.
Arsenal made a bright start, as Ozil found himself with space for a shot from the edge of the Bayern penalty area after a driving run by Alexis Sanchez, but Neuer got down at full stretch to save.
The hosts were then carved open on 11 minutes down the right as a clever one-two from Thomas Muller released Thiago into the box, and his snap-shot was beaten away by Petr Cech.
The Germans, who have scored 38 goals in their 12-match winning run in all competitions this season, continued to dominate possession, and Cech was called on again to parry away a lofted effort from Arturo Vidal.
Arsenal, though, had a great chance to take the lead on 33 minutes.
Nacho Monreal whipped a ball in from the left, which Walcott sent goalwards with a bullet header from six yards. Neuer threw out a strong hand to somehow claw it off the line, with Aaron Ramsey unable to scramble the loose ball in at the far post.
Arsenal resumed the second half with spirits raised from their positive spell, but were soon back on the defensive as the busy Douglas Costa sent a 20-yard rising drive just over.
Wales midfielder Ramsey pulled up with what looked like a hamstring injury on 57 minutes and was replaced by England’s Alex Oxlade-Chamberlain.
Bayern were in again when Robert Lewandowski was played clear on the right side of the Arsenal penalty area, but Cech made a superb save with his chest to send the ball over the bar and deny the in-form Poland forward.
It proved a crucial intervention as Arsenal snatched the lead with 13 minutes left.
A deep free-kick from Santi Cazorla caused panic in the Bayern box, where Neuer was caught in no man’s land, flapping at the loose ball and Giroud, just on for Walcott, was perfectly placed to bundle a stooped header into the empty net.
With the clock running down, Lewandowski turned into the right side of the penalty area, but delayed his shot under pressure from Laurent Koscielny.
Arsenal broke deep into stoppage time, with Hector Bellerin scampering away down the right. His low cross was side-footed goalwards by Ozil. Although Neuer pushed the ball out and Oxlade-Chamberlain scuffed the rebound over, the additional assistant correctly ruled Ozil’s shot had crossed the line.