The humble Swiss team, who qualified for the last 16 at the expense of Manchester United after a momentous victory against the English side, had St Jakob-Park rocking again as substitute Valentin Stocker scored an 86th-minute winner.
Basel, who often play in front of only a few thousand fans in the Swiss league, hit the woodwork twice, then survived long periods of Bayern pressure before snatching victory.
While Basel's players milked the crowd's acclaim, Bayern trooped off thinking the unthinkable.
Their Allianz Arena hosts the final this year but after failing to score an away goal they are in serious danger of their dream being dashed in the last 16.
The Bavarians, who have slipped to third in the Bundesliga after a dip in form, missed the injured Bastian Schweinsteiger, decribed by coach Jupp Heynckes before the game as the brains of the team and in the same class as Barcelona's Xavi and Andres Iniesta.
Arjen Robben was restored to the starting line-up at the expense of Thomas Muller, a surprise move by Heynckes which failed to have the desired effect.
Basel's win was a rare boost for Swiss football following the national team's failure to qualify for Euro 2012 and the problems facing their domestic game.
Those have seen Sion docked 36 points for fielding ineligible players, a case which nearly earned the country suspension by FIFA, and Neuchatel Xamax kicked out of the league for a series of administrative problems under Russian-born owner Bulat Chagaev.
"We are very happy but we know we're only halfway there," said Basel's coach Heiko Vogel, who has only been in charge since November and spent nine years working with Bayern's youth divisions where he coached some of the present Bayern team.
"The recipe is very simple, we have an unbelievable will to win and great understanding. We have fun every day during training and that shows."
Goalkeeper Yann Sommer, whose saves kept Bayern in the game, said: "We have beaten maybe the best two teams in the world, it's amazing what happened here, we believed in ourselves. Bayern played well but luck was on our side."
Franck Ribery had a shot blocked by Sommer in the third minute and was denied shortly afterwards when he was sent clear but Sommer pushed his effort into the side-netting as Bayern made a promising start.
"If Ribery's chances had gone in it would have been a different game," said Heynckes.
Bayern had two let-offs in quick succession, firstly when Aleksandar Dragovic's header was pushed away by Neuer, hit the inside of the post and bounced out.
The woodwork saved Bayern three minutes later when Alexander Frei, Switzerland's record international goalscorer, crashed a shot against the crossbar from 12 metres after a Park Joo Ho's slide-rule pass found him free in the middle.
Bayern took control of the midfield after that, enjoying lots of possession although their attacks lacked imagination.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.