Three goals in nine minutes during the closing stages turned the match on its head, with Gareth McCauley looking to have rescued a point only for the hosts to snatch victory
Martin Paterson put the visitors ahead with a powerful strike after 14 minutes, but Aurelien Joachim struck via a defletion just before the break to level.
Stefano Bensi's low drive gave the hosts the lead with 12 minutes remaining, only for Gareth McCauley to convert Oliver Norwood's cross to equalise five minutes later.
Mathias Janisch snatched victory, however, when he fired home following a goalmouth scramble after 87 minutes.
Mario Mutsch returned from suspension and was drafted straight back into a Luxembourg side that shipped 17 goals in seven qualifiers prior to Northern Ireland's visit.
Northern Ireland were without the banned duo of Kyle Lafferty and Chris Brunt, both sent off in Friday's 4-2 defeat against Portugal, with Burnley defender Daniel Lafferty replacing the latter in the starting line-up.
Lars Gerson stooped to head over a ninth-minute corner as the home side produced an encouraging start that was halted five minutes later by a moment of magic from Paterson.
The Huddersfield Town striker controlled Shane Ferguson's pass with a first touch that took him clear of his marker just outside the penalty area before rifling low into the bottom corner with a rasping finish.
Mutsch powered wide from a free-kick routine after 25 minutes as Luxembourg looked for an equaliser, and Gerson struck the crossbar with a curling effort, although the linesman's flag was raised for offside.
Roy Carroll palmed away Bensi's strike after he cut in from the left flank, but the Olympiakos goalkeeper was powerless to prevent Luxembourg from hauling themselves level in added time at the end of the first half.
The hosts broke quickly, David Turpel eventually picking up possession in the centre circle before splitting the Northern Ireland defence with a pass that Joachim latched on to.
Joachim's shot struck Daniel Lafferty and looped over Carroll with virtually the last kick of the half.
Clearly energised following Joachim's fortuitous goal, Luxembourg started the second half strongly, Bensi crashing a free-kick from in the Northern Ireland area inches wide after Carroll has been penalised for a pass back from McAuley.
Substitute Billy McKay squandered a gilt-edged chance to put the visitors ahead with 22 minutes remaining.
A Paterson backheel allowed McKay to scamper in on goal and his first touch took him away from the onrushing keeper, but he stumbled and blazed over from six yards.
That miss proved decisive as Bensi edged Luxembourg ahead after 78 minutes. The Northern Ireland defence afforded the striker too much time and space 20 yards out and he duly dispatched an unstoppable effort across Carroll into his bottom right corner.
Four minutes later, though, Northern Ireland drew level as McAuley rose well to meet Oliver Norwood's free-kick and he powered a header that bounced past Jonathan Joubert.
But there was still time for more late drama as Janisch prodded home from close range with three minutes of normal time remaining after the Northern Ireland defenders failed to clear a corner.
That goal secured the Red Lions' first home World Cup qualifying victory since they beat Turkey 2-0 in 1972.