Hamburg, with interim coach Rodolfo Cardoso and sports director Frank Arnesen on the bench after the club sacked Michael Oenning on Monday, ended a four-game losing streak.
Martin Harnik gave Stuttgart an 18th-minute lead when Hamburg keeper Jaroslav Drobny spilled Zdravko Kuzmanovic's long-range effort and the Austrian international tapped the ball in for his third goal in two games.
Stuttgart could have added another four minutes later but Cacau hit the post from close range.
Hamburg refused to capitulate and upped their game midway through the first half.
They levelled five minutes after the restart when on-loan Chelsea defender Jeffrey Bruma (pictured) headed in from five metres.
Robert Tesche then grabbed the winner with a spectacular volley from just inside the box after 67 minutes.
Hamburg, who have never been relegated from the Bundesliga, climbed one place to 17th with four points from seven games.
Stuttgart are sixth on 10 points.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.