Bundesliga leaders Bayern Munich came back from two goals down to clinch a victory over Freiburg thanks to Lennart Karl's 99th-minute winner.