Sean Longstaff netted twice, but Gabriel Osho and Ross Barkey responded for the visitors on each occasion before Carlton Morris converted from the penalty spot after a VAR intervention in the second half.
Elijah Adebayo then seemed to have put the match beyond the Magpies, but Kieran Trippier and Harvey Barnes, on his long-awaited return to action from a foot injury, hauled Eddie Howe's men back into a thrilling affair.
United, looking for a third straight victory in all competitions, went in front in the seventh minute thanks to a superbly-worked goal.
Lewis Miley spread a wonderful ball out to Trippier on the right and his cutback was drilled home by Longstaff for his second goal in United's last three matches.
But Luton, who had only won once before at St. James' Park, levelled in the 21st minute as Morris nodded Barkley's free kick across goal and Osho's header crashed off the underside of Martin Dúbravka's crossbar before bouncing over the line.
United, though, roared back within a matter of seconds, with Anthony Gordon bursting past Osho on the left. Thomas Kaminski parried his right-footed strike, but could only push it into the path of Longstaff - arriving late into the box - and was helpless to keep out his low drive.
Teden Mengi blocked an effort from Gordon before, in the 41st minute, the Hatters equalised for a second time.
Barkley drove forward and fed Alfie Doughty, whose effort was saved by Dúbravka - but Barkey was following in to score.
Before the break, Fabian Schär - who scored twice in Newcastle's win at Aston Villa in midweek - made another valuable contribution as he got in the way of Morris' shot from close range.
Howe brought Callum Wilson on at half time, in place of the injured Gordon, and initially the enforced change appeared to have the desired effect as Jacob Murphy twice came close at the Gallowgate End.
First, he danced into the box but his shot was blocked by Kaminski, then the winger sent a piledriver off target.
But the game changed when Luton were awarded a spot-kick. The dangerous Chiedozie Ogbene burst past Dan Burn before being tugged back, seemingly outside the area; however, after referee Thomas Bramall had awarded a free kick, he changed his mind after a lengthy VAR check.
Morris sent Dúbravka the wrong way from the spot, but was then ordered to retake his kick as the referee wasn't ready. However, the Luton man made no mistake when he stepped up for a second time to give his side the lead for the first time.
Then three minutes later, the Hatters broke swiftly through Doughty, who played in Barkley to tee up Adebayo to make it 4-2.
Trippier gave United hope as he swept past Kaminski after a superb outside-of-the-boot ball from Bruno Guimarães, seconds after Longstaff had been denied a hat-trick by some desperate defending.
In the 73rd minute, Barnes - making his first appearance since September as a second-half substitute - completed an astonishing comeback with an inch-perfect finish from the edge of the box.
Pelly Ruddock Mpanzu forced a save from Dúbravka in the 75th minute, then Mengi deflected a Guimarães effort behind at the other end.
Barnes saw another strike pushed around the post by Kaminski before a low Guimarães cross from the left flashed agonisingly across goal.
But despite ten minutes of stoppage time, and a good chance for Ogbene which was kept out by Dúbravka, there wasn't to be a ninth goal of the afternoon as the fixture finished all square.