
Albert Grønbæk gave Hamburg the lead in the 41st minute and immediately picked up where he left off in the second half to score a brace in the 46th. Louis Lemke completed the win four minutes later.
Cologne fell behind when David Abrangao gave third-division Kickers the lead in the 18th.
But Ísak Bergmann Jóhannesson was on target in the 62nd and then again in the 77th to turn the game around and save Cologne from becoming the first Bundesliga team out of the Cup.
There have been some minor surprises, however, as Rot-Weiss Essen of the third division won 2-0 at home against St Pauli, relegated from the Bundesliga last term.
Heidenheim, who were also relegated to the second division last season, were humbled in a 5-2 defeat to fourth-tier Jeddeloh II.
Later on Monday, promoted Bundesliga side Schalke visit fourth division Hallescher FC.
Bayern Munich and Borussia Dortmund have their first-round ties in September due to Saturday's Franz Beckenbauer Super Cup won 2-1 by Bayern. The holders visit second-tier VfL Osnabrück and Dortmund take on amateurs HEBC Hamburg.