Scotland crashed out of the Under-20 World Cup Finals in Canada after a last-minute goal gave Costa Rica a crucial victory.
Dejected Scotland captain Scott Cuthbert
Mark Reynolds had given the Scots the lead in 18 minutes, calmly sliding the ball home from six yards.
However, in 57 minutes, Pablo Herrera equalised for the Costa Ricans.
Having lost their opening two matches, both teams desperately needed a win. The decisive goal came in injury time, struck by Jonathan McDonald.
The Scotland management team of Archie Gemmill and Tommy Wilson made four changes after the disappointment of the 2-0 defeat by Nigeria.
Scott Fox, Michael McGlinchey, Graham Dorrans and Sean Lynch came in to the starting line-up, replacing Andy McNeil, Ross Campbell, Robert Snodgrass and Jamie Adams.
Gemmill will be desperately disappointed that his team did not maintain the level of their first-half performance.
Whether it was the changes to the side or the predicament in which they found themselves, the Scots started the game very brightly.
At last there was passion and skill, and most of the errors that had characterised the first two matches against Japan and Nigeria had been erased.
In six minutes Lee Wallace typified the more positive play by surging down the left, beating a few players before winning a corner. From the resultant in-swinging kick, Mark Reynolds hit the post with a strong header.
With a noisy support in the Burnaby crowd, and Dorrans controlling play in midfield, Scotland were dictating the play and forcing Costa Rica on to the back foot.
But in Pablo Herrera, "Los Ticos" had a player who forever looked dangerous and inventive. It was his pace and control that kept Scotland's defence on its toes.
Steven Fletcher and Calum Elliot were posing problems for the opponents' defence and things were looking positive for the Scots as they drove forward to try to claim one of the four best third-placed slots to make it to the last 16.
Despite the lively start from Gemmill's men, it was a player with a very Scottish-sounding surname playing for Costa Rica who nearly got the opening goal.
In 16 minutes Jonathan McDonald took control of the ball from inside the box and drilled a low shot, which Fox did well to save to his right.
Two minutes later in Scotland's best move of the match at that point, Mark Reynolds took advantage of a slip-up in the Costa Rican defence, running through to slip the ball past Alfonso Quesada from just six yards.
A period of dominance by Scotland was interrupted in 35 minutes when midfielder Esteban Rodriguez played a pass reminiscent of the great Dennis Bergkamp. He played a long controlled ball inside full-back Wallace which Dave Myrie met without breaking his stride. A foul by Wallace prevented the move progressing.
As half-time approached Fletcher, Elliot and Dorrans continued to keep the Costa Rican goalkeeper busy.
At the start of the second half, Scotland should have gone two goals up. However, Fletcher failed to find balance or composure and struck his shot wide.
This seemed to be the turning point in the match. Where before the Costa Ricans had played balls over the top of Scotland's defence, now they played a shorter, more creative game.
In the 50th minute Fox rushed out to make a point-blank save from Herrera. Just seven minutes later, the same player side-footed the equaliser. Scotland's efforts to clear the low cross ball into the box failed due to a combination of bad luck and poor timing, as neither Wallace or Cuthbert could prevent the ball going through to Herrera.
The Costa Ricans had found another level to their game, and this coincided with Scotland players tiring in the heat. The shots were raining in from Herrera and McDonald and Fox had to be at his best just after the hour mark to tip a scorching shot on to the post.
As the match moved into the final stages, Elliot made a fine run into the opposition half to relieve some pressure on his defence, but, surrounded by three Costa Rican players, he was offered no support.
Mark Reynolds executed a beautiful overhead kick to showcase his talent in the 71st minute, but the goal didn't count as the linesman had already raised his flag.
With both sides in desperate need of a win to prolong their presence in the tournament for at least 24 hours, Costa Rica looked the fitter side.
In the 92nd minute, Scotland's defence failed to clear the ball and Jonathan McDonald ran through to thump the ball beyond Fox.
The Scots slumped to the turf. A third defeat had ended their Canadian adventure.