The New Saints were knocked out of the Conference League as they twice squandered the lead in a 3-2 defeat at Celje.
The Welsh Premier champions twice led in the first half after Danny Davies and Rory Holden scored.
But Edmilson levelled within a minute on both occasions and then David Zec won it for the Slovenian side in the second half as TNS exited the competition.
Craig Harrison’s men took the lead when Davies headed home Ryan Brobbel’s free-kick in the 19th minute, with the goal surviving a VAR check.
But the advantage was short-lived as the hosts levelled almost immediately as Edmilson slotted past Connor Roberts after latching on to a loose pass.
The Slovenian side thought they had gone in front when Mark Zabukovnik converted soon after but he was ruled offside after a VAR check.
It was Saints who went back in front, though, as three minutes before half-time Holden finished off a quick counter-attack.
But they again could not hold on to their lead for more than a minute as Svit Seslar’s ball set Edmilson clear and he made no mistake.
Strong second-half pressure from the hosts eventually took its toll on Saints and they conceded in the 79th minute.
Zec was in the right place at the right time to tuck home a loose ball from close range to win it for the home side.