Dennis Rommedahl created one goal and then scored the winner for Morten Olsen's side on a memorable evening for the Ajax winger, who was winning his 98th cap.
Samuel Eto'o handed Cameroon the perfect start inside 10 minutes when he latched onto Pierre Webo's pass and buried a shot beyond Thomas Sorensen after Christian Poulsen had inexplicably given the ball away deep inside his own half.
Poulsen's blunder set the tone for some comical defending at both ends.
But Denmark's equaliser owed more to the blistering pace of Rommedahl, who burst down the right and crossed for Nicklas Bendtner to equalise with a sliding finish at the back post on 33 minutes.
Eto'o struck the post and the impressive Achille Emana also went close, while Alexandre Song produced a crucial block to deny Jon Dahl Tomasson all in the space of three mad minutes close tothe interval.
But Rommedahl showed his class to eventually settle this enthralling contest in the 62nd minute with a weaving run and curling finish to complete the comeback and leave Paul Le Guen's side heartbroken.
It could have been so different for the Africans after they made a positive start.
Le Guen stood accused of playing an inexperienced side in the opening game that included players out of position, but he recalled both Geremi and Song for this contest and the Africans looked brighter from the start.
They still needed an horrendous defensive mistake from Poulsen to help gift them the lead but it was taken with clinical precision by Eto'o, who plundered his 43rd international goal.
Yet Olsen's side showed industry and endeavour to weather the storm and drew level before the break when Bendtner met Rommedahl's cross following a quicksilver break from the veteran winger.
Both sides wasted further chances, which came about from some woeful defending, with Eto'o striking the post and Song atoning for an earlier error to block a certain goal for Tomasson at the opposite end.
Rommedahl kept his cool to put Denmark ahead but Olsen's men were still indebted to Sorensen, who denied Emana with a wonderful save in the final 20 minutes as Cameroon pushed hard for an equaliser.
The result also sees the Netherlands qualify for the knockout stages after their earlier victory over Japan.
Cameroon (4-4-2): Hamidou; M'bia, Bassong (Idrissou 72), Nkoulou, Assou-Ekoto (Aboubakar 78), Geremi, Eyong (Makoun 46), A Song; Emana; Eto'o, Webo.
Denmark (4-4-1-1): Sorensen; S Poulsen, Kjaer, Agger, L Jacobsen; Rommedahl, C Poulsen, Jorgensen (Jensen 46), J Gronkjaer (, Khalenberg 67); JD Tomasson (J Poulsen 86); Bendtner.