Jurgen Klopp's men looked set to tie after surrendering an early lead, but finally kept themselves mathematically in the Bundesliga chase thanks to late heroics from Lewandowski
Lukas Piszczek had given his side the advantage in the second half, but the hosts never submitted and were worthy of the draw thanks to Alexandru Maxim's equaliser, only for the Poland international to swoop in the dying minutes.
Dortmund found the first half tough against a determined Stuttgart team, who pressed hard and appeared a team far better than their bottom-half position would suggest.
With both sides impressing in attack and less so at the back, the result was an open, action-filled first 45 minutes. BVB were the first team to threaten the scoreline, Marco Reus given a golden opportunity when played through by Mario Gotze. The forward had just Sven Ulreich to beat, but in trying to round the keeper was denied by an outstretched leg.
Ibrahima Traore nearly opened the scoring thanks to an error from Marcel Schmelzer, while at the other end Reus was again the man who threatened most in yellow. The youngster was played through by a wonderful pass from Lewandowski, and from wide out tried an audacious chip to fool Ulrich. The keeper was completely beaten, but breathed a sigh of relief when it fell the wrong side of the post. Unable to convert in front of goal, Reus nevertheless played a big part in establishing the away lead.
The forward was fouled by the left touchline, and picked up the ball himself to whip in a free-kick. The delivery was pitch-perfect, as was a delicate glancing header from Piszczek that floated into the corner of the net. Stuttgart protested, incensed that the foul was given in the first place; but it was to no avail, and it was Dortmund who took a slightly fortunate advantage into the interval.
The set piece delivery of Alexandru Maxim had been one of Stuttgart's best outlets during the first half, and a free kick from the playmaker really should have restored parity for the home side early after the break. The cross found Georg Niedermayer blissfully open in the six-yard box, but with the goal at his mercy the defender headed wide to miss the best chance of the match for his side.
Stuttgart continued to press, and again went agonisingly close thanks to Maxim. His free kick was turned onto the post by Martin Harnik, and with the rebound Antonio Rudiger thought he had equalised. It was not to be, however; Mario Gotze came to the rescue of his side with a fantastic clearance off the line, somehow preserving BVB's slim lead. Despite the youngster's heroics, the pressure was building to an unbearable level for the visitors, and the leveller looked inevitable.
With 30 minutes left to play, the home team finally found the breakthrough. After impressing so much with the dead ball, Maxim showed what he could do in open play; taking down a loose ball and striking with precision past Weidenfeller to make it 1-1. Just as things were looking up for Stuttgart, they were dealt a blow; Neidermayer's bloodthirsty challenge on Gotze earned a second yellow for the defender, meaning his side would have to play the final 20 minutes a man down.
Dortmund continued in search of the winner, and with eight minutes left were vindicated. A tired home defence was stretched by the overlapping Piszczek, and his low cross was smashed home by Lewandowski to break Stuttgart hearts.
BVB continue four points clear of Leverkusen as they occupy second place, while the unlucky hosts stay in 12th.