Ollie Watkins netted a first-half brace for Villa, but Luton produced a second-half fightback, halving the deficit in the 66th minute through Tahith Chong, before Carlton Morris made it 2-2 in the 72nd minute.
Rob Edwards's side then went in search of a winner, but Villa managed to find the game's fifth goal in the 89th minute, with Lucas Digne heading home from close range to break Luton hearts.
Villa remain fourth but are now five points ahead of fifth-placed Tottenham Hotspur and 11 clear of Manchester United in sixth, while Luton stay 18th, four points behind 17th-placed Nottingham Forest with a game in hand.
The visitors had an early sight of the Luton goal, with Leon Bailey delivering a dangerous cross into the penalty box, but Jacob Ramsey could only chest wide of the post under pressure.
Ramsey was a big threat for Villa in the early exchanges, with the attacker again breaking towards the Luton goal in the fourth minute, but Amari'i Bell was across to make the challenge, before the defender was forced to leave the field moments later due to an injury.
Luton goalkeeper Thomas Kaminski was called into action in the 14th minute to keep out an effort from Ramsey, who has been found inside the home team's penalty box by John McGinn.
Douglas Luiz had a half-chance from the resulting corner, but the Brazilian's header was wide of the target, before Kaminski made another smart save to deny Watkins in the 23rd minute.
Villa made the breakthrough from the resulting corner, though, with Watkins heading the delivery from Bailey into the back of the net to silence the home supporters.
Clement Lenglet headed a delivery from McGinn over the crossbar in the 32nd minute, with Villa looking for more goals against a Luton side that were struggling to get going at Kenilworth Road.
Watkins came close again in the 34th minute, with the Englishman firing just wide of the far post after working a yard of space in a dangerous position.
Villa doubled their advantage in the 40th minute, with Watkins finding the back of the net with an emphatic finish after collecting a quick free kick from Luiz; the goal was initially disallowed for offside, but the resulting VAR check showed that the 28-year-old was just onside.
Morgan Rogers came close to making it 3-0 in the 44th minute, as he sent one towards the far corner of the net, but Kaminski was on hand to make a brilliant save.
Luton attacker Andros Townsend had a half-chance to make it 2-1 in the closing stages of the first period, but the experienced attacker headed over the crossbar from close range, before Kaminski denied Bailey down the other end, with two goals separating the teams at the half-time break.
The hosts were the better side at the start of the second period, with Villa finally coming under some pressure, but Edwards's side were finding it difficult to carve out clear opportunities.
Morris had a half-chance from a corner in the 57th minute, but his header was just too high.
The pressure continued from Luton, but as has often been the case this season, the final piece of quality in the final third of the field was lacking.
The hosts did manage to register in the 66th minute, though, with Chong firing into the back of the net following a period of panic inside the Villa box, with Matty Cash heading one off the line and Villa goalkeeper Emiliano Martinez making a save before Chong halved the deficit from close range.
Luton then levelled the scores in the 72nd minute, with Morris volleying an excellent free kick from Alfie Doughty into the bottom corner of the net.
Morris came close to sending the home side 3-2 ahead three minutes later, but his header was kept out by Martinez, with Villa just about holding on at Kenilworth Road.
Morris had another golden chance in the 85th minute, volleying just wide of the far post this time, although the offside flag was raised shortly after.
Villa ultimately broke Luton hearts in the 89th minute, with substitute Digne heading a cross from Moussa Diaby into the back of the net from close range to win it for the visitors in incredible circumstances.
Teden Mengi had a late chance to make it 3-3 from a corner, but he headed over the crossbar.
Emery's side will now switch their attention to the UEFA Conference League, travelling to Ajax for the first leg of their last-16 contest on Thursday, before taking on Tottenham in a huge league fixture next Sunday.
Luton, meanwhile, will be bidding to avoid a sixth straight defeat in all competitions when they travel to Crystal Palace in the Premier League next Saturday afternoon.