Euro 2012 co-hosts Poland went ahead early in the second half through Robert Lewandowski but Germany replied quickly when Toni Kroos converted a penalty after substitute Thomas Muller was fouled in the area.
Poland were reduced to 10 men when Arkadiusz was sent off but they stunned the visitors in the 89th minute when Jakub Blaszczykowski fired home from the penalty spot.
The home celebrations were cut short though when Cacau pounced in stoppage-time to convert a Muller cross.
"When you lose a goal after such a stupid play, then you have to be angry," Lewandowski, who scored Poland's first goal against Germany in 31 years, told reporters.
"All we needed is five seconds. This would have been our first win ever against Germany."
The friendly was the first international match played at the PGE Arena, one of the stadiums for Euro 2012.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.