The FA Cup runners-up suffered an early setback at the KC Stadium when Tomas Malec scored for the Slovakians after only 91 seconds, and the Tigers struggled to respond.
Ahmed Elmohamady equalised before the half hour to give Hull a lifeline but, for the next hour, City looked set to exit the competition on away goals - and ahead of schedule.
Yet with 10 minutes remaining, super-sub Aluko smashed home from close range to send Hull into Friday's draw for the Europa League play-offs.
Last week's trip to Zilina saw the ring-rusty Tigers labour to a goalless draw but they were back on home turf and playing in front of 21,156 excited fans.
Steve Bruce packed his midfield with attacking talent, handing new arrival Robert Snodgrass his full debut and using winger Robbie Brady to complement Elmohamady on the other flank.
And the mission seemed straightforward - dazzle the Slovakians with Premier League pace, trickery and guile.
Yet a Trencin goal inside two minutes meant Hull would need to score at least twice to remain in the competition.
When some early probing came to nothing, Trencin countered at leisure down the Hull right and Malec was well-placed to receive the low cross and sweep the ball beyond Allan McGregor.
The Slovakians were not sitting back and went close to dealing Hull a double blow when Jakub Holubek stung McGregor's palms from the D.
It was time for Hull to have a go. Set free down the left by Yannick Sagbo, Shane Long pushed the ball inside and powered into the area, but he saw his close-range chip pushed clear.
In the 24th minute they tried again, Jake Livermore releasing Sagbo in behind Trencin right-back Peter Cogley.
But Snodgrass miscued his effort on the cross and, when the ball arrived at Brady's feet six yards out of goal, he twice rattled it against Milos Volesak.
The winger redeemed himself, however, by providing the killer cross for Hull's equaliser.
Once more exploiting the left side, Brady found the space he needed to pick out Elmohamady, whose powerful header squeezed over the line despite the best efforts of goalkeeper Volesak.
The Tigers had their tails up and the capacity crowd roared as one when Long nodded a Snodgrass corner straight down Volesak's throat with half-time fast approaching.
Five minutes into the second half if it was McGregor who watched the ball spin out for a corner as a clutch of Hull players struggled to close down Haris Hajradinovic.
When the hour mark arrived City fans were getting restless as their heroes toiled in vain around the Trencin box.
There was a cheer when Snodgrass' free-kick from distance got Volesak working again but a bigger one when Tom Ince replaced Alex Bruce to make his home debut.
Hull only had 20 minutes to rescue their European season when the former Blackpool man steamed down the right wing before taking a bad touch and losing control of the ball.
So eager were City fans to see their new man pick up his game and make a decisive impact on the outcome, they barely noticed when Aluko entered the fray for the tiring Long.
They would certainly notice him, in the 80th minute, as Snodgrass headed Elmohamady's cross into the six-yard box for Aluko to prod home on the half-volley and inspire raptures in the home crowd.
For all their enterprise Trencin had looked devoid of ideas some time and they were ultimately unable to deny Hull their historic victory before the final whistle blew.
St Johnstone's quest to reach the Europa League group stages ended in failure after they were held to a draw against Spartak Trnava in the second leg of their third qualifying-round tie.
Stevie May's deflected effort three minutes before half-time handed St Johnstone a lifeline following their 2-1 defeat in Perth but they failed to build on their advantage in the second half.
And a blunder from Gary Miller allowed Martin Mikovic to level with eight minutes left to seal a 1-1 draw for the hosts and a 3-2 aggregate victory.
The goal could be May's last for the club amid talks with Rotherham and reported interest from Sheffield Wednesday but ultimately it counted for nothing as Saints failed to do enough to get the 2-0 win they needed.
However, the Scotland Under-21 striker was inches away from forcing extra-time when he threw himself at a cross amid some late pressure from the visitors.
Aberdeen were knocked out of the Europa League after two late goals gave Real Sociedad a 3-2 victory in their third qualifying-round second leg encounter at Pittodrie.
Peter Pawlett and Mark Reynolds scored either side of a first-half Xabi Prieto strike to give Aberdeen a 2-1 lead, but they could not find the further two goals needed to progress.
Sociedad captain Prieto then broke Aberdeen hearts by scoring from the penalty spot with four minutes remaining and Bergara Markel scored moments from the end to give the Basque side victory on the night and a 5-2 aggregate triumph.
- Sports & Recreation
- Europa League
- Robert Snodgrass
- Ahmed Elmohamady