The hosts had taken a first half lead through Danny Green’s powerful strike but Orient equalised just before the hour when Lloyd James converted from the penalty spot.
Luton were then reduced to ten men on the 80th minute when Jack Marriott was given his marching orders, but benefitted from a huge slice of luck in the final minute when Ryan Hall’s shot came off the head of Stephen O’Donnell and flew into the top corner to cruelly dump Orient out of the cup.
For the trip to Kenilworth Road Leyton Orient Head Coach Ian Hendon made five changes to the side that defeated Bristol Rovers on the weekend.
With Alex Cisak away on international duty Charlie Grainger was handed his debut while loanee Joe Maguire also made his first appearance since arriving on loan from Liverpool, partnering Connor Essam in the centre of defence.
Blair Turgott, Ollie Palmer and Scott Kashket all came into the starting XI as Hendon named a young substitutes bench which included first-year scholar Myles Judd.
In what was a relatively slow start to the match it was Luton who nearly drew first blood when former Orient defender Scott Cuthbert shot wide from a corner.
It was the hosts who enjoyed the brighter opening spell as Danny Green first sent a free-kick over the bar before having a shot deflected into the side netting which led to Scott Griffiths heading wide from the corner.
With the O’s failing to grab a foothold in the tie Ian Hendon’s side then conceded the opening goal for the first time this season.
Having already come close twice it was Green who broke the deadlock when he took Luke Guttridge’s pass into his stride on the corner of the penalty area before unleashing an unstoppable drive beyond the reach of Charlie Grainger in the Orient goal.
Green could then have had a second towards the end of the half when he got on the end of a cross from the left but despite connecting well with his shot, Orient defender Frazer Shaw was well positioned to clear off the line.
Just before the break Orient then had a chance to snatch an equaliser against the run of play but Ollie Palmer could only fire straight at Hatters’ stopper Mark Tyler after being put through by Blair Turgott.
During the break Orient were dealt a blow however as captain Sean Clohessy was forced off with an injury.
Freddy Moncur came on in his place to make his professional debut as Bradley Pritchard moved to right back and the O’s reverted to a diamond in midfield, with Turgott at the tip and Lloyd James - who also took the armband - at the base.
Orient were far from their fluid best during the opening 45 minutes but also started the second half poorly as Pelly Ruddock Mpanzu curled an effort wide before Grainger produced a good reaction stop to keep out Green’s inswinging cross.
Turgott then combined well with Palmer on the edge of the oppositions penalty area but after turning swiftly he could only fire a tame effort at Tyler who saved comfortably.
Two minutes later the O’s were then handed a lifeline when Scott Kashket showed great agility inside the box resulting in the young forward being bundled over by Griffiths to earn a penalty.
James then stepped up to take the spot-kick and repeated his heroics from the weekend as he sent Tyler the wrong way to level the tie.
With the match all square Luton looked to immediately regain their advantage but brave blocks from Maguire and Essam at the heart of the O’s defence replenished a number of attacks.
A dangerous run into the box from Palmer then nearly created a chance for Orient to take the lead as the ball dropped to the feet of Kashket but Tyler reacted well to hold his low shot.
The forward was looking like a different player after winning the penalty and with just less than 20 minutes remaining must have thought he had put the O’s in front.
After superb battling from Turgott to prevent the ball from rolling out for a goal kick Kashket raced in to pick up the loose ball, before dinking a shot over Tyler only to see Hatters’ captain Jim McNulty get back to claw his effort off the line.
With ten minutes left to play Luton were then reduced to ten men when Marriott was giving his marching orders for a gesture towards the O’s travelling fans after missing a header from close range.
Following the dismissal Hendon then made his second change of the night as first-year scholar Myles Judd came on in place of the O’s goal scorer James.
Orient should probably have then taken the lead when a Moncur corner found its way to Essam at the back post but the defender could only lift his shot over the bar.
As penalties beckoned Hendon then handed a fifth youngster their O's debut as Portugese winger Sandro Semedo replaced Palmer for the final minutes.
There was to be no penalty shoot-out however as Luton snatched a 90th minute winner with a huge slice of luck.
Substitute Ryan Hall saw his initial free-kick crash back off the wall before taking aim for a second time. The shot then took a nick off the head of Hatters’ full-back Stephen O’Donnell before sailing into the top corner with Grainger rooted and send the O's out of the Johnstone's Paint Trophy despite a battling display.
LUTON: Tyler, O’Donnell, McNulty (C), Cuthbert (Okuonghae 59), Griffiths, Lee, Smith, Green, Guttridge, Ruddock Mpanzu (Hall 72), Marriott
SUBS: Justham, Mackail-Smith, McQuoid
GOALS: Green (29), O'Donnell (90)
BOOKINGS: McNulty (37)
SENT OFF: Marriott (80)
ORIENT: Grainger, Clohessy (C) (Moncur HT), Essam, Maguire, Shaw, Turgott, Pritchard, James (Judd 83), Moore, Palmer (Semedo 87), Kashket
SUBS: Woods, Adeboyejo
GOALS: James (59 pen)
BOOKINGS: James (37), Shaw (89)
Referee: Nicholas Kinseley
Attendance: 1,953 (300 O’s fans)