There was penalty drama aplenty at the Red Bull Arena on Wednesday as Bayern Munich reached the last 16 of the DFB-Pokal thanks to a 5-4 shoot-out win over 10-man RB Leipzig.

After nine successful kicks, Timo Werner - who started on the bench - saw his weak penalty to the right saved low down by Sven Ulreich, who had come in for some criticism since replacing the injured Manuel Neuer as Bayern's number one.

The shoot-out followed a highly controversial 1-1 draw, which saw referee Felix Zwayer change his mind in awarding Leipzig a first-half penalty before giving the home side a soft spot-kick in the second period, either side of Naby Keita's dismissal for two cautions.

Emil Forsberg converted from 12 yards but Bayern were soon level through Thiago Alcantara and after the extra 30 minutes produced no further goals, the visitors kept their cool to join holders Borussia Dortmund in the draw.

Leipzig had been left furious in the opening half as Arturo Vidal, on his 100th Bayern appearance, scythed down Forsberg with contact continuing into the area.

Zwayer originally pointed to the spot but, with the VAR system not in use, spoke to his assistant and instead signalled for a free-kick on the edge of the box.

After Keita was dismissed for the third time this season shortly after the interval, it was Bayern's turn to feel aggrieved with Zwayer, who gave a penalty after Yussuf Poulsen fell theatrically under Jerome Boateng's challenge.

Forsberg put Leipzig ahead but Thiago's header soon pegged them back and, despite wasting a host of chances in extra time, Jupp Heynckes' side retained their composure when it mattered most.

Leipzig had thrown away a 4-2 lead to lose 5-4 to Bayern in May, and this contest was equally thrilling, though not quite as goal-laden – with another course of this developing rivalry set to be served up in the Bundesliga on Saturday.

The first contentious moment arrived in the 34th minute as Zwayer reneged on his initial decision to penalise Vidal's brainless tackle and awarded a free-kick, from which Forsberg clipped the top of the crossbar to add further insult to injury.

Leipzig sporting director Ralf Rangnick stormed onto the field at half-time with phone in hand, seemingly ready to show the referee a replay of the incident until he was confronted by an angry Mats Hummels but the hosts could have few complaints with Zwayer in the 53rd minute as Keita picked up a second yellow for a cynical tug on Robert Lewandowski.

Bayern looked to swiftly capitalise on their man advantage as Kingsley Coman was kept out by Peter Gulacsi at his near post before Lewandowski broke clear and fired agonisingly wide.

But just as Bayern looked primed to put Leipzig away, Poulsen took a tumble under minimal contact from Boateng and Zwayer pointed to the spot immediately, Forsberg doing the rest.

The lead lasted just five minutes, however, as Boateng clipped a sumptuous pass over the Leipzig defence for Thiago, who sent a free header beyond Gulacsi.

Thiago stung the palms of the keeper with a fierce volley, Bernardo blocking Lewandowski's rebound and in the first period of extra time, Gulacsi made a superb double save to thwart Thiago and Joshua Kimmich.

Bayern introduced the unheralded Kwasi Okyere Wriedt and he almost marked his debut in style as a header crashed off the bar before Lewandowski saw a volley tipped over by Gulacsi.

The Poland forward headed over from point-blank range and that was the last real chance as Ulreich proved Bayern's shoot-out saviour in a contest fittingly decided from 12 yards when Werner's feeble effort followed nine perfect penalties.