Scotland led for most of a hotly contested game with South Africa before succumbing to a an equaliser in the dying seconds.
With the game tied at 3-3 Homeless World Cup rules mean that the teams go straight into a sudden-death penalty shoot.
Both scored with their first attempts before Scotland missed their second.
That left South Africa to score and pick up the win.
The result left Scotland tied with Ukraine at the bottom of a group won by Brazil, who beat second placed Portugal yesterday to continue their unbeaten run.
At the Homeless World Cup every team competes throughout the tournament so Scotland and Ukraine both progress into the Mexico City Cup.
As do England, raising the possibility of an Auld Enemy clash on Sunday.
Before that though that Scotland play Norway today while England face up to Czech Republic.
Brazil play Austria in the top ranked Homeless World Cup with Mexico, Portugal, Bosnia and Herzegovina, Chile, Lithuania and Indonesia also still in contention to lift the trophy on Sunday evening.
Wales, defeated by Argentina yesterday, move into the De La Calle A La Cancha Cup and face Peru today.
Ireland, who finished third in Scotland's group, play Haiti in the The Fundación Telmex Cup.
The Scotland game will be live on www.homelessworldcup.org at 6.10 pm this evening.
These people feel like a piece of shit
As I've been saying all week the Homeless World Cup tournament is simply a celebration of the work that goes on for the other 51 weeks of the year.
Work to change lives by using football to empower people.
Work by people like Mexico manager Daniel Copto.
The Homeless World Cup affiliated project in Mexico now involves 7,000 people each week.
Addicts and homeless people from across the country brought together by football and given a belief they might otherwise have lost:
"As far as the authorities are concerned, these people do not exist.
"These people feel like a piece of shit. And you have to tell them they are not a piece of shit, so they can do whatever it takes to get better."
"We must build trust. Empower them."
Read more about Daniel's work in Mexico