BAYERN MUNICH edged past 10-man RB Leipzig on penalties after Liverpool signing Naby Keita saw red.
Midfielder Keita – who will join the Reds next summer in a £48million deal – received a second yellow after 54 minutes.
But after three unsuccessful appeals – which saw sporting director Ralf Rangnick confront the officials at half-time – RB were finally given a spot-kick and Emil Forsberg stepped up to slot them into the lead.
Thiago Alcantara equalised five minutes later and Leipzig stopper Peter Gulacsi made a series of superb saves to send the game to extra-time.
Neither side could break the deadlock as Gulacsi held firm despite waves of Bayern pressure.
But RB finally fell in the shootout as Bayern netted all five of their penalties before Timo Werner missed the decisive kick.
Latest Bayern Munich news
The Budesliga champs’ 5-4 victory sees them reach the third round, with the sides meeting against the Alianz Arena on Saturday in the league.
Leipzig coach Ralph Hasenhuettl fumed: “It’s a shame that this great match was ruined by Keita’s sending off.
RB GAVE ME WINGS Red Bull Leipzig star Peter Gulacsi reveals why he walked away from Liverpool to become one of Europe’s top goalkeepers
“The boys can be proud of themselves, but that does not detract from their frustration that I felt in the locker room.
“They gave everything and were not rewarded.”
Manuel Neuer’s stand-in Sven Ulreich was the hero for Bayern after saving Werner’s penalty.
The modest 21-year-old said: “I’m just glad I could help the team.”