The Maltese side, in the competition after losing the FA Trophy final to double winners Valletta, started well at the Ta'Qali National Stadium and could have been ahead in the 15th minute.
Michael Mifsud had a chance to open the scoring from the penalty spot after Attila Busai had brought down Andrea Scozzese inside the penalty area, only for the experienced striker to miss the opportunity from 12 yards.
With six minutes of the half remaining the hosts did take the lead as Stanley Ohawuchi converted Paltemio Barbetti's pass.
However, the hosts were thwarted as the 29-time Hungarian champions levelled with 13 minutes to play through Nalepa's strike.
Dundalk produced an effective away performance against Jeunesse d'Esch in Luxembourg to secure a 2-0 lead.
The Irish outfit sit second in the Premier Division and harnessed that momentum to take control of the tie.
Richard Towell was the hero for Stephen Kenny's men as he netted twice in the second half to wrap up the victory.
The defender's first came from a penalty after David McMillan had been fouled by Adrien Portier, and the 22-year-old was on hand again in the 71st minute to double his tally.
Meanwhile, Shkendija have a narrow advantage in their tie with Zimbru after a 2-1 win in Skopje.
Forward Bojan Vrucina gave the Macedonian side the lead in first-half stoppage time and victory looked assured when Ivan Mitrov increased the lead two minutes after the break.
Zimbru piled the pressure on in the second half and Alexandru Grossu's penalty gave the Moldovans a valuable away goal.
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1