Heidenheim produced a fairytale comeback win over Bayern despite Harry Kane netting his 32nd Bundesliga goal.