St Patrick's Athletic left Kazakhstan with their hopes of qualifying for the third round of the Europa League still alive after a 2-1 defeat to FC Shakhter Karagandy.
The Kazakh side took the lead early in the second half, defender Nikola Vasiljevic scoring from a Zhambyl Kukeyev corner.
Substitute Dave McMillan equalised for Pat's with just over 10 minutes left on the clock but Karagandy scored again, Vasiljevic scoring for a second time with just five minutes left, giving his side the lead ahead of Thursday's second leg.
Kargandy deserved their lead having had the majority of the chances although Derek Doyle and Paul Crowley both had efforts at goal for Pat's in the first half.
Pete Mahon made changes, with Crowley and fellow striker Anto Murphy replaced by David McMillan and Ian Daly as they continued to search for an equaliser in the second half.
Both McMillan and home captain Andrei Finonchenko picked up yellow cards as Karagandy continued to have most of the play. Karagandy sub Serik Dosmanbetov was also yellow carded in injury time.
But Pat's kept plugging away and their efforts eventually bore fruit, with McMillan finding the net soon after Pat's captain Steven Bradley had a free-kick saved by Aleksandr Grigorenko in the Karagandy goal.
A draw looked to be on the cards after another Rogers' save, and an Evan McMillan chance from a Bradley corner, before Vasiljevic's second gave his side a narrow advantage ahead of Thursday's second leg.