Uruguay, who have exceeded expectations at the tournament to emerge as South America's last survivors, found themselves trailing to Thomas Mueller's goal after 18 minutes.
But the lead lasted just 10 minutes as Uruguay's fighting spirit once again re-surfaced, Edinson Cavani and Diego Forlan firing Oscar Tabarez's side into a 2-1 lead.
In a see-saw encounter, Marcell Jansen's header made it 2-2 before Loew's Germany secured a bronze medal eight minutes from time thanks to Khedira after Uruguay had failed to deal with a corner.
Still the drama was not over.
Forlan, with five goals to his name at the tournament, was presented with a chance to clinch the Golden Boot award - as well as force extra-time - when Arne Friedrich fouled Luis Suarez on the edge of the area deep into stoppage time.
With the last kick of the game, the Atletico Madrid player curled his set-piece around the German wall but his effort crashed against the bar to cap a dramatic finish to a thrilling game.
By scoring three times, Germany end the tournament with 16 goals which is the most they have scored in a single World Cup since 1970.
Germany, handicapped by the absence of Miroslav Klose, were extremely fortunate not to be reduced to 10 men as early as the fifth minute after a dreadful challenge by Dennis Aogo on Diego Perez.
Bayern Munich's Klose needed just one more goal to equal Ronaldo's all-time record of 15 World Cup goals.
But Klose, who has found the target four times in South Africa, was forced to watch from the bench after suffering a bout of flu.
And unless Klose is picked for Germany's 2014 squad as a 36-year-old, his bid to equal Ronaldo's record looks over.
Yet his absence failed to hamper his side as the three times World Cup winners rattled the woodwork before taking the lead.
Defender Friedrich, who broke his international scoring duck in the 4-0 quarter-final hammering of Argentina, headed against the bar in the 10th minute, but Uruguay were not so fortunate nine minutes later.
Mueller, who has enjoyed an outstanding tournament, was first to pounce from close range after Bastian Schweinsteiger's 30-yard rocket had been spilled by keeper Fernando Muslera.
But just as they did against Ghana in the quarter-finals, Uruguay fought back to level after an uncharacteristic error by Schweinsteiger.
Germany's player of the tournament contender had the ball stolen from his feet by Perez on the halfway line which allowed Uruguay to break with pace in the 28th minute.
Suarez, back in the side after his one-match ban for deliberate handball against the Black Stars, released Cavani whose clinical right foot finish beat Germany's second-choice stopper Hans-Joerg Butt.
Suarez was booed throughout because of his 'Hand of God' moment that denied Ghana a semi-final spot, but the 23-year-old Ajax man was involved in the move that saw his side take the lead in the 51st minute.
Suarez played a neat one-two with Egidio Arevalo which saw the latter cross for Forlan to acrobatically volley into the ground and into the net.
But the lead lasted five minutes before Jansen made it 2-2 with a header after connecting with a cross by new Manchester City signing Jerome Boateng before Khedira had the final say.
Uruguay (4-4-2): Muslera; Caceres, Lugano, Godin, Fucile; M Pereira, Arevalo, Cavani, Perez (Gargano 76); Suarez, Forlan.
Subs (not used): Castillo, Silva, Victorino, Scotti, Eguren, A Pereira, Lodeiro, Gonzalez, A Fernandez, Abreu, A Fernandez.
Germany (4-5-1): Butt; Boateng, Friedrich, Mertesacker, Aogo; Muller, Schweinsteiger, Ozil (Tasci 90), Khedira, Jansen (Kroos 80); Cacau (Kiessling 73).
Subs (not used): Neuer, Wiese, Badstuber, Lahm, Trochowski, Marin, Podolski, Klose, Gomez.
Referee: Benito Archundia