Bayern had lost three matches in a row for the first time in nine years with the club announcing this week coach Thomas Tuchel would leave in the summer.
Kane broke the deadlock midway through the first half but Leipzig hit back with 20 remaining, Benjamin Sesko equalising for the visitors.
With Bayern looking to concede further ground to Leverkusen in the title race, Kane stepped up and scored in the first minute of injury time, his 27th league goal of the season.
Bayer Leverkusen…
The win keeps Bayern eight points behind Xabi Alonso’s Bayer Leverkusen, with 11 games remaining this season.
Kane had a golden chance to release the pressure on the home side just five minutes in but his point-blank header was pushed onto the post by Janis Blaswich.
The England captain went close once more just before half-time but his artistic bicycle kick was directed straight at Blaswich.
Kane finally broke through after 56 minutes, slamming a low shot into the Leipzig goal, his 26th strike in 23 games.
Leipzig, who had not lost to Bayern in the league in two years, were bullish and turned the screws on the under-pressure German champions, breaking through after 70 minutes through Sesko.
Sesko collected a short Dani Olmo pass and drove his shot low, with the ball deflected by Leon Goretzka and rolling into the net.
The match looked set for a stalemate until Kane latched onto a pass from Eric Maxim Choupo-Moting, before volleying past Blaswich to seize a valuable win for the under-pressure side.
– Stuttgart held –
Earlier on Saturday, Stuttgart were held to a 1-1 draw at home by Cologne.
Stuttgart were without injured Brighton loanee Deniz Undav, who had scored five goals in his past four league games, picking up the slack from striker Serhou Guirassy, who has only recently returned to club action after the Africa Cup of Nations.
Stuttgart took the lead in the 53rd minute, Enzo Millot finishing off the type of well-worked team move which has become the hallmark of Sebastian Hoeness’ side this season.
Cologne drew level nine minutes later, though, Eric Martel tapping in after being left unmarked at the far post from a free-kick.
After needing to win a two-legged relegation play-off to stay in the top division last campaign, Stuttgart have been this season’s Bundesliga surprise package and stay third as they bid to return to the Champions League for the first time since 2010.
A disappointed Stuttgart captain Waldemar Anton said: “If you want to play international football you have to come out on top in games like this.”
Union Berlin vs Heidenheim
Elsewhere, Union Berlin drew 2-2 at home to Heidenheim.
The visitors forged ahead through Nikola Dovedan in just three minutes thanks to a defensive blunder from Union.
Germany left-back Robin Gosens drew Union level in the 44th minute, sending an ungainly shot across the face of goal and into the net, moments before Andras Schafer gave the hosts the lead.
Heidenheim, who are surprisingly within touching distance of the European placings in their first top-flight season, equalised through Jan-Niklas Beste, who chipped the ball home after a counter-attack.
Borussia Moenchengladbach vs Bochum
Borussia Moenchengladbach thumped Bochum 5-2 at home, picking up a crucial three points to move eight clear of the relegation play-off spot.
Darmstadt vs Werder Bremen
Darmstadt went within inches of a third win of the season, having two goals chalked off in the dying stages for offside and handball in a 1-1 draw at Werder Bremen.
The result keeps Darmstadt dead last on 13 points.
AFP