The result piles added pressure on Bayern head coach Niko Kovac, as his side's chances of winning a seventh straight title in his first season in charge took another blow.
"We allowed ourselves to be beaten twice on the counter, that shouldn't have happened," said Kovac.
"We should have been more compact and unfortunately we lost a game which should have been a draw," he added after Robert Lewandowski had two second-half goals disallowed for offside.
Bayern have now been beaten in three of their last six Bundesliga games after defeats by Hertha Berlin and Borussia Moenchengladbach, managing just eight points from the last 21 available.
They will drop to fourth in the table on Sunday if RB Leipzig beat Bayer Leverkusen at home.
Lucien Favre's Dortmund remain unbeaten and four points clear of second-placed Gladbach at the top of the table.
After Lewandowski twice gave Bayern the lead at Signal Iduna Park against his former club, Dortmund captain Marco Reus hit two equalisers before substitute Alcacer struck in the 73rd minute.
"We didn't trust ourselves in the first half, but we played awesome football after the break and it was great fun," said Reus.
Alcacer has now scored eight goals in six league appearances since signing on loan from Barcelona.
Bayern took a deserved lead when Serge Gnabry curled in a cross for Lewandowski to power a header past stand-in Dortmund goalkeeper Marwin Hitz on 26 minutes.
It was 1-0 at the break, but Dortmund drew level when Manuel Neuer brought Reus down in the area in the 49th minute and the skipper calmly converted the penalty.
Lewandowski restored the lead three minutes later, heading home his second -- his 14th goal in 16 matches for Bayern against Dortmund, who he left in 2014 on a free transfer.
Reus had a chance cleared off the line on 59 minutes, just before Lewandowski had the ball in the Dortmund net, but was flagged for offside.
It was end-to-end stuff as Alcacer, then Reus blew golden chances before both made amends with goals.
Reus finally fired Dortmund level when he volleyed home a Lukasz Piszczek cross in the 67th minute.
Then when Franck Ribery gave the ball away, Alcacer showed some classy finishing by rounding Neuer to put Dortmund ahead for the first time.
Bayern kept the pressure on during a tense five minutes of added time.
Lewandowski had the ball in the net for a fourth time, but again the flag went up for offside to the delight of the home fans in the sell-out 81,365 crowd.
"That was a crazy game, a great advert for the Bundesliga and the win wasn't undeserved," said Dortmund boss Favre.
Earlier, Alassane Plea scored a quickfire hat-trick for second-placed Gladbach, who are three points ahead of Bayern, in their 3-1 win at Werder Bremen.
Plea took just 13 minutes to claim his hat-trick to leave him level on eight goals at the top of the goalscoring charts along with Alcacer and Lewandowski.
Hosts Bremen suffered their third straight league defeat to drop further back in the title race to sit seventh.
Ten-man Hertha Berlin, who like Bremen have seen their title aspirations fall apart, crashed to a 4-1 defeat at struggling Fortuna Duesseldorf after winger Maximilian Mittelstaedt was sent off for two yellow cards in the first half.
However, Fortuna remain second from bottom after VfB Stuttgart also claimed victory as defender Timo Baumgartl and midfielder Erik Thommy scored in a 2-0 win at Nuremberg.
English teenager Reiss Nelson scored an 84th-minute winner as Hoffenheim built on their 2-2 draw at Lyon in the Champions League in midweek with a 2-1 win at home to Augsburg.
Nelson, on loan from Arsenal, settled the matter with his sixth goal in seven league games just two minutes after coming on.
Mainz are up to ninth after they backed up last weekend's win over Bremen with a 3-1 victory at Freiburg.