The Southampton forward's 70th minute strike, just five minutes after his introduction as a second half substitute, gave Ireland an unlikely win and sets them up for a final day showdown in Poland, who drew 2-2 against Scotland, with automatic qualification up for grabs.
Germany controlled much of the game, but a hugely impressive, disciplined display by the hosts kept them scoreless, and in the end Long's howitzer sealed a memorable victory.
The visitors came to Dublin in confident mood, needing just a single point for qualification and coach Joachim Löw was fortunate to be able to call upon a full strength team, although Bastian Schweinsteiger was a late withdrawal following an abductor injury in the warm up.
Martin O'Neill faced a different challenge with regulars like Glenn Whelan, Marc Wilson, Ciaran Clark and James McClean absent through injury or suspension ahead of the toughest test of his reign.
The former Celtic boss included Burnley's Stephen Ward and Ipswich Town's Daryl Murphy in attack – a brave decision that would be deemed genius by the full time whistle.
“The players put in a fantastic effort. To beat the world champions is sensational,” said O'Neill.
“We showed bravery and courage. We had to withstand a lot of pressure, which you'd expect, and we did that.
“We have reached the play-offs now and we can go for it on Sunday.”
An unimpressed Löw countered: “It's an unexpected and entirely unnecessary defeat.
“We had a lot of chances to score but we also lacked precision when it mattered most.”
A full house of 50,604 turned up daring to dream, and just moments into the game they were cheering the news that Poland had taken an early lead in Glasgow against Scotland.
It was to be a night where keeping focus was difficult, but Ireland's players mostly did so for the first half, reaching the break all square.
Toni Kroos, Marco Reus, Thomas Müller and Mario Götze enjoyed bouts of possession, as Germany's high pressing game gave them control.
Few clear chances followed, but Jerome Boateng should have opened the scoring when he was given the freedom of Dublin at a corner and headed over Shay Given's goal.
Germany also failed to make the most of a host of corners in the first half, but John O'Shea had to be on top form to block Ilkay Gundogan's effort from the edge of the box.
Defensive partner Richard Keogh timed a sliding tackle perfectly to deny Götze a tap in, and when Mesut Ozil did have the ball in the net, it was ruled out for offside.
The German defence were relatively untroubled, with Jon Walters's half-hearted penalty appeal and a weak shot all the Irish had to show for some good phases of play, with Norwich's Wes Hoolahan the outstanding player in green.
Both sides were forced into changes before the break with Andre Schürrle replacing Götze, while veteran Irish goalkeeper Shay Given gave way to Darren Randolph after twisting his knee.
Schürrle almost made a rapid impact, getting on the end of Reus's stunning pass ten minutes after the restart, but the Wolfsburg star failed to hit the target.
Ireland grew into the game as news filtered through that Scotland had taken the lead in Glasgow and Murphy flashed a strike wide just after the hour mark.
Reus continued to torment Ireland's right wing, but Ward, Christie and O'Shea were heroic in defence.
Then came the moment the home crowd didn't even dare dream of; Long outpaced Mats Hummels and Jerome Boateng before thundering a shot past Manuel Neuer to stun the world champions.
Müller squandered a golden opportunity to level things before Boateng stung Randolph's fingers with a long range effort but Ireland held on for a famous, and crucial, victory.