UEFA EURO 2012 co-hosts Poland looked to have secured a first win over Germany at the 17th attempt when midfielder Jakub Blaszczykowski, known as Kuba, converted a penalty in the 91st minute to make it 2-1. But in a dramatic finale, German blushes were spared when second-half replacement Thomas Mueller fired in a cross with time almost up to allow Cacau to equalise on 94 minutes as Germany again came from behind.
"It was a very special game," said Polish-born German forward Lukas Podolski. "We had some good chances in the first-half and if we had scored our goals, things would have looked differently. But you have to compliment the Poles, they put up a great fight."
Both Polish goals came from players who ply their trade with Bundesliga champions Borussia Dortmund as striker Robert Lewandowski put the hosts ahead on 55 minutes before Kuba's late penalty.
German midfielder Toni Kroos had put his side level on 68 minutes when he netted a dubious penalty, but the hosts were reduced to ten men when defender Arkadiusz Glowacki was sent off for a second yellow card on 80 minutes.
After Germany beat Austria 6-2 on Friday night, confirming their place at Euro 2012 next June, Germany coach Joachim Loew made sweeping changes. Vice-captain Bastian Schweinsteiger, play-maker Mesut Ozil and goalkeeper Manuel Neuer all missed the trip and Loew opted to play a 4-1-4-1 formation for the first time.
Germany's teenage star Mario Goetze joined Kroos in the middle with Lukas Podolski and Andre Schuerrle on the wings with veteran Miroslav Klose up front, but the experiment nearly back-fired.
Polish coach Franciszek Smuda named 21-year-old Arsenal goalkeeper Wojciech Szczesny, who was outstanding, while Dortmund's Kuba, fellow goal-scorer Lewandowski and Cologne's Slawomir Peszko were constant thorns in the German defence.
Peszko squandered two chances to put his side ahead in the first-half when he managed to get in behind the German defence. At the other end, defensive midfielder Simon Rolfes' deft early flick failed to beat Szczesny, while both Polish-born Germans Klose and Podolski were denied by the Arsenal man.
Poland took the lead at the sold-out PGE Arena when Kuba's pass split the defence allowing Lewandowski to hold his nerve to fire home. Germany were awarded a penalty when Podolski's replacement Thomas Mueller was sent tumbling and Italian referee Daniele Orsato pointed to the spot.
The replay showed there was no contact between Mueller and Glowacki, but Kroos drilled home the spot-kick on 68 minutes. Szczesny capped a fine performance when he pulled off a superb save to deny Schuerrle's long-range shot with 15 minutes left.
Having been shown a yellow for the foul on Mueller, Glowacki was shown a red card for bringing down Goetze to leave Poland with ten men for the last ten minutes.
The game took a dramatic twist when Wiese brought down replacement striker Pawel Brozek with time almost up and Kuba hammered home the spot-kick much to the Polish fans' delight. But Loew has plenty to thank Mueller for after his perfectly-timed cross allowed Cacau to get Germany out of jail.