The Bluebirds received a huge injury boost when David Marshall was able to start after a finger injury made him a doubt for the match but he was beaten just five minutes in when Marcel Schafer headed home.
After a missed chance by Adam Le Fondre, the Germans went two goals up in the when former Chelsea attacker Kevin De Bruyne fired home from 25 yards.
But it was 2-2 at the break thanks to a long-range free-kick from Peter Whittingham and Nicky Maynard’s finish after a fine run from Fabio.
Just before the hour-mark, Cardiff’s comeback was complete when Kenwyne Jones rattled the bar and Kim Bo-Kyung tapped in.
With seven minutes to go, Ivica Olic pounced for the sixth goal of a enthralling encounter.