Despite defeating Samoa in their final pool game, in a last-minute thriller in Nantes, Scotland's under-20 side were edged out of reaching their first fifth to eighth play-off spot.
Head coach Sean Lineen said: "It was tough. We were quite a way ahead early on in the game, leading 21-5, then we took our foot off off the gas a little, starting making mistakes and let them back into the game.
"The game see-sawed a bit after that, and we ended up level, then Ben Cooper kicked the penalty to put us 36-33 ahead.
"Samoa were camped on our line at the end of the game and there were nine phases of play before we forced a knock-on and the whistle went."
The Scots then had to await the outcome of the match between South Africa and France, hoping that South Africa got a bonus-point victory and France didn't lose with a bonus point - ultimately, although South Africa won 26-19, it wasn't enough to put Scotland through to the next level of the competition for the first time.
Lineen added: "Ben kicked the goals that mattered but there was some great work from Chris Auld in the centre and Damien Hoyland on the wing. We made it very difficult for ourselves, however, with lots of mistakes and lots of unforced errors.
"It was a new experience for these players to win a pool game but we still have a lot of work to do."
It was a nervy start as both teams looked to get the measure of each other, with Samoa missing two penalties early on. Nanai scored first for Samoa, the try unconverted which sparked the Scots into a score just seconds after the restart, Farndale crossing and the score converted by Tommy Allan to make it 7-5.
Allan was next on the score sheet, converting his own try to increase lead to 14-5, swiftly followed by a try from Damien Hoyland, converted by Allan to make it 21-5.
Just ahead of the half-time hooter, Samoa fought back with a converted score from Broomhall to make it 21-12 at HT
As the second half kicked off, Samoa kept their momentum to put Amituanai over, the try converted to reduce the lead to 21-19.
A yellow card for Malaki gave Scots the man advantage and a try for Robbie Fergusson increased the lead to 26-19. Another converted try, the score from JJ Kilmartin with the extras from Ben Cooper, made it 33-26 then Samoa drew level when their captain Ah Sam scored, the conversion successful.
A Ben Cooper penalty increased the lead to 36-33 and despite sustained pressure from Samoa in the final minutes, the Scots held out for victory.
Scotland will now go on to play USA in the 9th-12th play-offs on Tuesday 18 June, kick-off 7.15pm BST at Stade Pascal Laporte in Nantes.
Tommy Allan is currently fifth top scorer in the tournament, on 25 points.
Scotland under-20 teamv Samoa under-20 in round three of the 2013 IRB Junior World Championship (Pool C) at the Stade Pascal Laporte, Nantes
15 Jamie Kilmartin (Bath Rugby)
14 Jamie Farndale (Edinburgh Rugby/Edinburgh Accies)
13 Chris Auld (Edinburgh Rugby/Gala)
12 Robbie Fergusson (Ayr)
11 Damien Hoyland (Boroughmuir)
10 Tommy Allan (Perpignan)
9 Ali Price (Glasgow Warriors)
1 James Malcolm (GHA) *
2 Russell Anderson (Gala) *
3 D’Arcy Rae (Ayr) *
4 Eoghan Masterson (Leinster)
5 Jonny Gray CAPTAIN (Glasgow Warriors/Currie)
6 Tommy Spinks (London Scottish)
7 Alex Henderson (Boroughmuir)
8 Adam Ashe (Glasgow Warriors/Stirling County)
16 Callum Black (Edinburgh Accies) (on for Anderson, 40m)
17 Jamie Bhatti (Stirling County) * (on for Malcolm, 63m)
18 Phil Cringle (Edinburgh Rugby/Stewart’s Melville FP) (on for Rae, 66m)
19 Ruairidh Leishman (Stirling County) (on for Hoyland, 78m)
20 Will Bordill (Glasgow Warriors) (on for Henderson, 55m)
21 Scott Steele (Leicester Tigers) (on for Price, 55m)
22 Ben Cooper (Otley)(on for Allan, 40m)
23 Rory Hughes (Glasgow Warriors/Stirling County) (on for Fergusson, 60m)
* supported by sportscotland Institute of Sport
Scotland under-20 JWC fixture schedule:
Argentina under-20 (44-13) Scotland under-20
Scotland under-20 21-26 Wales under-20
Scotland under-20 36-33 Samoa under-20
Scotland v USA, Stade Pascal Laporte, Nantes on Tuesday 18 June, k/o 7.15pm BST