Young Arsenal keeper Vito Mannone, on loan at Barnsley, handed Luton the three points with a last-minute boob after Mike Newell's men had earlier given him an easy ride.
The 18-year-old Italian made his home debut as a replacement for the suspended Nick Colgan but was rarely troubled by the Luton strikers who peppered the stands with their shots.
The youngster, behind the league's leakiest defence, was beaten by a brilliant strike from Carlos Edwards but then 14 more efforts were off target until he mishandled a late cross and substitute Ahmet Brkovic headed the winner.
It was a nightmare repeat of his huge gaffe at Preston when he punched a late clearance against the head of Patrick Agyemang to send Barnsley to defeat again.
Barnsley should have been in front after carving out two chances in quick succession in the first six minutes.
With the pressure on from a corner, Bobby Hassell headed across goal leaving former Barnsley keeper Marlon Beresford stranded as Paul Hayes connected with his head but Lewis Emanuel somehow headed the chance off the line.
A minute later the some neat inter-play between Brian Howard and Martin Devaney had Luton back-pedalling and Devaney should have scored but his low left footer from 15 yards was easily held by the keeper.
Ex-Luton trainee Michael McIndoe swung across a 35th minute corner that dipped over to Hassell but his looping header was over the top.
When the ball broke to Devaney wide on the right, instead of crossing, he tried a wild shot on the run and only found the stand before Howard smacked the bar with a volley from 15 yards.
Moments before half-time Marc Richards drilled a volley over and when play swung to the opposite end Edwards darted in and saw his low angled shot held by Mannone.
But two minutes into the second half Luton went ahead when Barnsley failed to clear a cross from Dean Morgan and it dropped for Edwards in space. He kept his head, span and hit a rasping shot from the edge of the box.
Luton held on to the lead for less than a minute before Hayes slipped a neat ball through for Howard who beat Leon Barnett's challenge and stabbed the ball past Beresford as the keeper came out.
The visitors could have been in front immediately after Barnsley had levelled but Rowan Vine's cross was headed wide by Richard Langley who should have done better.
But at the death Mannone handed the chance to substitute Brkovic who gratefully headed the ball home.