St Johnstone face an uphill struggle to progress in the Europa League after losing 2-1 at home to Spartak Trnava of Slovakia.
The visitors broke the deadlock midway through the first half through striker Ivan Schranz's left-footed effort.
A mistake in the Saints defence allowed Schranz to double Trnava's advantage in the second half.
However, captain Dave Mackay slotted home from close range in injury time to give the Perth team hope.
Saints went into the match without talismanic striker Stevie May, who was still struggling with a thigh injury picked up in training during the week.
Only moments into the match Chris Millar was played through one-on-one with Trnava goalkeeper Dobrivoj Rusov, but the Slovak was quick off the mark to smother.
Despite that early chance, Trnava had the better of the early exchanges and Schranz forced Alan Mannus into a double save first from a low shot, then from a header from the resultant corner.
Millar tried his luck from long range, which flew off-target, but it was Spartak who dominated possession, with Schranz and Erik Sabo both going close.
It seemed only a matter of time before the visitors took the lead, and they did midway through the first half when the impressive 20-year-old Schranz rifled in a left-foot shot high into the net from 15 yards.
Things weren't working for Saints, and it was no surprise that manager Tommy Wright changed things around at half-time, swapping David Wotherspoon to the left and pushing Michael O'Halloran into a central role to support lone striker Steven MacLean.
The change at least brought a shot on target from the hosts, as Wotherspoon's drive forced Rusov into a save.
Gary Miller then popped up to connect with an Easton cross at the back post as Saints finally began to show some attacking intent, but his header went wide.
However, Trnava were always looking to counter, and Schranz tapped in a second from close range after Saints keeper Alan Mannus parried his first effort.
Wotherspoon hit the top of the bar with a powerful late effort, but it seemed a forlorn effort with only three minutes left of the 90.
But, in the third minute of five added on, Wotherspoon flashed the ball across the box, and Mackay was in the right place to net with a low shot and keep Saints in the tie.
St Johnstone: Mannus, Miller, Mackay, Wright, Brian Easton, Brown, Millar (McDonald 29), Croft, Wotherspoon, O'Halloran (Kane 76), MacLean.
Subs Not Used: Banks, Scobbie, Anderson, Caddis, Dylan Easton.
Booked: Wright, Miller, Kane.
Goals: Mackay 90.
FC Spartak Trnava: Rusov, Siva, Bortel, Toth, Conka, Janecka, Sabo, Casado Garcia, Schranz (Mikinic 88), Vlasko (Chovanec 78), Mikovic (Vyskocil 61).
Subs Not Used: Strapak, Richnak, Spalek, Kasaj.
Booked: Bortel, Vlasko.
Goals: Schranz 34, 64.
Referee: Mattias Gestranius (Finland).