The 29-24 extra-time win meant that John Dalziel’s men finished seventh in the knock-out event after a gruelling three days of competition.
New Zealand won both the men’s and women’s events.
Having lost to the USA earlier on day three, the Scots managed to lift themselves for one last tie in California.
Jamie Farndale’s physicality out wide freed Jack Cuthbert to run in under the posts as Scotland scored first.
France responded with a try of their own, but Scotland hit straight back, Max McFarland showing his pace to finish in the corner as the ball was moved wide.
Two France scores either side of half time saw Scotland fall behind before Robbie Fergusson collected a Farndale offload to dive over in the corner restoring his side’s lead.
The game kept going back and forth and the French scored under the sticks to lead 24-19 with a minute left to play, but Farndale was Scotland’s saviour, diving over in the corner to send the tie to extra-time.
Farndale then capped a fine showing all week by himself to grab the winning try, running the length of the field to score.
Head coach Dalziel said: “I’m really pleased that in the last game we calmed down a bit and played our game.
“We had to dig in deep in extra-time and a special mention to Jamie Farndale who has had a fantastic season for us and was out on his feet at the end of that game and still sprinted 100 metres to score the winning try.”
Scotland team v France: Nyle Godsmark, Jack Cuthbert, Jamie Farndale, Robbie Fergusson (C), Harvey Elms, Alec Coombes, Max McFarland. Subs used: Scott Riddell, Jo Nayacavou, Gavin Lowe, Craig Jackson, Unused: Sam Pecqueur.
Scotland scorers v France: Tries: Cuthbert, McFarland, Fergusson, Farndale 2. Cons: Elms, Fergusson.