With only three outfield players on the bench, injury-hit Bayern looked on their way to victory when they recovered from a goal down to lead 2-1 at the interval thanks a Mario Gomez goal and a Bastian Schweinsteiger penalty.
In a frantic second half Borussia outplayed the visitors, exposing their chronic defensive weaknesses, levelling in the 56th minute through Marco Reus and retaking the lead through a beautiful Igor De Camargo effort four minutes later before Lahm got the equaliser with a well-taken chip from the right.
"We gave away a certain win in just 10 minutes (in the second half)," said Bayern coach Louis van Gaal.
"We have never played as good this season as in the first half but we just did not score enough goals. A top team is not allowed to lose the grip on a game in just 10 minutes."
Pirmin Schwegler struck the other Frankfurt goal before Ashkan Dejagah managed a consolation for the visitors midway through the second half.
Pedro Geromel had cancelled out Jens Hegeler's early strike before Ilkay Gundogan struck to put the hosts in front before the break. Julian Schreiber put the icing on the cake with a stoppage time goal.