Borussia Monchengladbach twice came from behind before handing Hamburg their first loss of the season and robbing them of a chance to grab the lead in the Bundesliga.
Piotr Trochowski gave Hamburg the lead in the 13th minute only to see Marco Reus equalise after 39 minutes. Ze Roberto re-established the advantage for the hosts in the 47th minute.
But fellow Brazilian Dante levelled the game again in the 76th minute and Rob Friend gave Gladbach the victory with his goal eight minutes before the final whistle.
Hamburg - the best team at home in the league - took the lead with the first chance of the game after 13 minutes. Jonathan Pitroipa chested down a ball into the area and passed over to Trochowski who blasted into the near left corner from 10 yards.
Gladbach knotted the game six minutes before the break with their first chance. After some fine passing between Raul Bobadilla and Roberto Colautti, the ball was fed through to Reus, who beat Hamburg keeper Frank Rost with a looping shot from 13 yards.
Hamburg however regained the lead just two minutes into the second half through Ze Roberto's 20-yard free kick off the the cross bar.
Gladbach nearly equalised again just after the hour mark as Tobias Levels' cross went to Juan Arango, whose header from nine yards went just over the crossbar.
Gladbach keeper Logan Bailly kept his team in the game with a superb stop on David Jarolim in the 72nd minute.
Dante levelled the game again for Gladbach just four minutes later, charging into the box to head home a corner from the left side.
And Friend gave Gladbach the lead eight minutes before the final whistle, beating Joris Mathijsen on the right side as Rost watched the ball roll into the near right corner.