Robert Lewandowski scored twice off the bench to send 10-man Bayern Munich into the German Cup semi-finals as his late penalty secured a 5-4 home win against second division Heidenheim on Wednesday.
Lewandowski came on for the second half and netted the winning penalty six minutes from fulltime for 18-times cup winners Bayern, who had Niklas Suele sent off after 15 minutes.
The Bundesliga champions took the lead through Leon Goretzka's 12th-minute opener, but goals from Robert Glatzel and Marc Schnatterer put the visitors ahead.
Thomas Mueller equalised eight minutes into the second half, before Lewandowski and Serge Gnabry gave the home side a two-goal cushion.
Yet Heidenheim did not give up and Glatzel netted twice more, including a penalty, in the space of four minutes to level.
A handball in the area earned Bayern a penalty that Lewandowski coolly converted, sending them through to the last four along with Hamburg SV and Leipzig.
Schalke 04 take on Werder Bremen in the last quarter-final tie later on Wednesday.