Thomas Muller and Serge Gnabry spared Bayern Munich's blushes by scoring late goals to scrape a 2-1 DFB-Pokal second-round win at Bochum, who finished the game with 10 men.
Alphonso Davies' first-half own goal gave Bochum a surprise lead and the second-tier strugglers looked on the brink of a famous upset with less than 10 minutes remaining.
But Gnabry levelled proceedings for the 19-time champions in the 83rd minute, a smart finish at the back post setting up a grandstand finale at Vonovia Ruhrstadion.
One-way traffic followed and after Armel Bella-Kotchap was given a red card for bringing down Muller, the Bayern star settled the contest by turning in Kingsley Coman's brilliant first-time cross for a dramatic 89th-minute winner.
Bochum gave a good account of themselves in the opening period and took the lead thanks to Davies' own goal, Danny Blum's cross from the left turned in by the makeshift left-back.
Niko Kovac introduced Robert Lewandowski at the break, with Philippe Coutinho and Muller soon following as Bayern sought an equaliser.
Blum continued to impress, though, and nearly caught Manuel Neuer out with an effort from inside his own half as Bochum sought to wrap up a first home win since May.
Bayern got more and more desperate as the match went on and they finally levelled when Gnabry was on hand to score from close range after Joshua Kimmich's cross.
The goal immediately changed the complexion of the match, Bochum retreating and inviting wave after wave of pressure.
Even a rare moment when Bayern did not have the ball caused a problem, as defender Bella-Kotchap dallied on the ball, lost his footing and brought down Muller as last man to stop him running through on goal.
A red card was the only option for referee Robert Schroder and the 88th-minute dismissal was quickly followed by the winner, Coman's outstanding ball across the face of goal capitalised on by Muller as the reigning champions survived a major scare.
What does it mean? Bochum still boosted
Bayern's eighth successive DFB-Pokal victory booked their place in the third round, but Bochum will take plenty of heart from a performance that should raise spirits for a side only off the bottom of the 2.Bundesliga on goal difference.
Blum catches the eye
Bochum may have lost in the end, but Blum did his best to give his side a chance of progression. The 28-year-old not only created their goal but was a constant threat down the left, his creativity and guile a highlight of the hosts' gallant display.
Tolisso's off night
Corentin Tolisso was not at his best in a sub-par Bayern performance. He had plenty of company in that regard, but Kovac had seen enough after 65 minutes and replaced the World Cup winner with Muller.
Bayern return to Bundesliga action against Eintracht Frankfurt on Saturday, while Bochum will look to climb the 2.Bundesliga table when they host Nurnberg on Monday.