Former European and German champion Hamburg SV missed out on promotion to the Bundesliga as it crashed to a 5-1 home loss to Sandhausen on Sunday, which was the final matchday of the second division season.
Heidenheim grabbed third place despite losing 3-0 to Arminia Bielefeld and will face 16th-placed Bundesliga club Werder Bremen in a promotion/relegation playoff over two legs.
Hamburg, relegated two years ago for the first time in its history, finished fourth despite needing just a point from its game.
The side was 2-0 down after 21 minutes through an own goal from Rick van Drongelen and Kevin Behrens's quick break. An Aaron Hunt penalty in the second half gave Hamburg renewed hope.
Behrens, however, grabbed his second goal with a spot-kick in the 84th to kill off Hamburg's chances of top-flight football, before Mario Engels added a fourth in the 89th and former Hamburg player Dennis Diekmeier fired in number five with the last kick of the game.
Second division champion Bielefeld and VfB Stuttgart have won automatic promotion, securing first and second place respectively before Sunday's matches.
Paderborn and Fortuna Duesseldorf were relegated from the Bundesliga.
- IND vs AUS Live Score Updates, 3rd T20: Gaikwad century powers India 222/3
- Ruturaj Gaikwad smashes maiden international century; becomes first Indian to score T20I hundred vs Australia
- IND A vs ENG A T20Is: Future prospects in focus as India A women face England A
- Hockey Nationals 2023: Punjab defeats Haryana to clinch title in thrilling penalty shootout
- V Koushik: Compensating pace with ‘right lengths’ to lead the Karnataka seam attack