David Moyes's side were saved by an inspirational performance from goalkeeper Lukasz Fabianski in the first half to keep the scores level ahead of the second 45.
It looked as if the Europa Conference League holders were set to take the tie back to East London even, however substitute Jonas Hofmann found the net in the final 10 minutes,
With the pressure increasing inside the BayArena, Xabi Alonso's side pushed for a second and were soon to find one, with Victor Boniface heading home off the bench in added-on time.
Following the victory over Union Berlin in the Bundesliga which all but secured Bayer Leverkusen's first-ever German title, Alonso made seven alterations to his side as he continued to stick by his rotation policy in the Europa League, with only Florian Wirtz, Granit Xhaka, Alex Grimaldo and captain Jonathan Tah keeping their places.
There was a major omission from the West Ham team, with last season's Europa Conference League winner Jarrod Bowen out of the matchday squad due to injury, meaning that Michail Antonio came in to lead the visitors' line, with the 34-year-old approaching a decade at the East London club.
Playing from the start during this quarter-final clash, Leverkusen's second-choice goalkeeper Matej Kovar was nearly tested in the early stages at the BayArena, however the Hammers were made to rue some lacklustre finishing inside the opening 15 minutes.
Providing a strong focal point for attack, the ball found its way to Antonio, and the Jamaican laid the ball off into the path of the onrushing Mohammed Kudus, who was unable to keep his shot on target, blazing over the bar.
As to be expected with the Bundesliga leaders, Alonso's men were dominating the ball but it took until the 21st minute for the hosts to really test the goalkeeping credentials of Fabianski in the Hammers' net.
Always looking to move forward with pace, Leverkusen left-back Grimaldo drove up the pitch and unleashed a nicely-executed curler towards the bottom-right corner, however Poland international Fabianski was able to get a solid hand to the attempt.
Not long after the West Ham stopper was required once again - this time it was Patrik Schick who fashioned room for a shot in the box, however Fabianski was on hand to prevent the strike nestling in the bottom right.
There was no shortage of controversy in the closing stages of the first period as West Ham's Antonio was wrestled to the ground in the box by Leverkusen captain Tah, however the decision of a penalty was not given and the scores were level at the break.
A flurry of substitutes occured in the middle of the second period as Alonso's charges looked to secure an advantage in the tie ahead of next week's second leg in East London, with the likes of Boniface and ex-Southampton winger Nathan Tella entering the BayArena fire.
Having surrendered over 70% of possession to their German counterparts, Moyes's side were hanging on for a draw as the full-time whistle drew nearer, however they were unable to see the job through following a corner-kick situation in the 83rd minute.
Spaniard Grimaldo delivered a corner kick to the back post where Tah managed to rise highest and head back into the feet of Boniface, whose goal-bound shot was blocked by Kurt Zouma, however the ball bounced towards Hofmann, with the 31-year-old's volley effort dribbling into the visitors' net.
Leverkusen were able to double their advantage in the opening stages of added-on time, when another corner-kick routine caused Moyes's men all sorts of problems, as their chances of reaching the last four of the Europa League seriously diminished.
Picking up the ball from a short corner, goalscorer Hofman turned provider, whipping in a delivery into the Hammers' box, and Nigeria international Boniface arrowed a header into the near post before Fabianski could attend to the effort.
Prior to next Thursday's all-important second leg at the London Stadium where West Ham will have an enormous amount of work to do, the Hammers will face Marco Silva's Fulham in the Premier League on Sunday.
With their unbeaten status in tact and now enjoying seven-game winning run across all competitions, Leverkusen can seal their Bundesliga crown with a win over Werder Bremen on Sunday.