Gian-Luca Waldschmidt's dramatic winner kept Hamburg in the Bundesliga courtesy of a 2-1 win over Wolfsburg at Volksparkstadion to condemn Andries Jonker's men to the relegation play-off.
A late Pierre-Michel Lasogga equaliser against Schalke last week kept Hamburg's hopes of snatching 16th place in the table off Wolfsburg alive, but they knew only a win on the final day would be enough to guarantee another year of top-flight football.
Wolfsburg looked well set as they drew first blood as Robin Knoche broke the deadlock in the 23th minute, beating goalkeeper Christian Mathenia with a strong header into the top left corner from Sebastian Jung's corner.
But the home side refused to throw in the towel and Filip Kostic levelled the scoring on the half-hour mark after being set up by Lewis Holtby.
Hamburg then went in search of the goal that would see them leapfrog Wolfsburg in the table, but they initially struggled to find a way through as the away side held firm in defence.
Waldschmidt eventually came to the rescue, however, heading the ball past Koen Casteels in the 88th minute from Kostic's delivery to score his maiden Bundesliga goal just moments after coming off the bench.
Hamburg maintain their record of never being relegated, while 2009 Bundesliga champions Wolfsburg face a nervy tie against one of Stuttgart, Hannover and Braunschweig to maintain their top-flight status.