
Ragnar Ache put Cologne in front midway through the opening half and Florian Kainz doubled the lead just after half-time.
Hamburg, who twice had goals ruled out by VAR, struck back through Jean-Luc Dompe but tempers boiled over in the closing stages.
Immanuel Pherai picked up two quick yellow cards and was sent off with 11 minutes remaining. Arsenal loanee Fabio Vieira soon followed him after collecting a second booking for remonstrating with the referee.
Said El Mala and Jakub Kaminski both scored for Cologne in stoppage time, with the victory lifting Cologne to seventh.
Former European Cup winners Hamburg, back in the Bundesliga after seven seasons in the second division, are in 13th place.
In Sunday’s late game, Wouter Burger scored twice for Hoffenheim who won 3-2 at Wolfsburg to climb to sixth.