Johannesburg, South Africa | AFP | The east African nations were deadlocked at 1-1 on aggregate entering stoppage time in Juba and a penalty shootout was looming in the first round second leg.
Makueth Nguet then became the hero of the youngest African nation when he scored to take his team through to a second-round tie with four-time Olympic qualifiers Tunisia next March.
Peter Taku had cancelled the one-goal lead Uganda took into the return match when he scored after just seven minutes at the national stadium in the South Sudanese capital.
South Sudan, who achieved independence from Sudan in 2011, have struggled in continental national team and club competitions and are ranked 47th of 54 African football nations.
Uganda were not the only team to suffer late heartbreak in a competition restricted to under-23 footballers during qualifying with three over-age players permitted at the finals.
Tanzania turned a 2-0 first-leg deficit against Burundi into a 3-2 overall lead by scoring three unanswered goals within 69 minutes in Dar es Salaam.
But the Burundians netted after 89 minutes through Laudit Mavugo and although they lost the second leg 3-1, the east Africans squeezed through on away goals after a 3-3 aggregate draw.
Burundi now face Congo Brazzaville over two legs between March 18 and 26, an international window when the final 2019 Africa Cup of Nations qualifiers will also be staged.
The Democratic Republic of Congo, a country that has never competed at an Olympic football tournament, trounced Rwanda 5-0 in Kinshasa after the first leg had ended goalless.
It was the widest winning margin among the 12 second legs with Mbuangi Muleka triggering the rout with a sixth-minute goal for a lead that stretched to 2-0 by half-time.
Goals by Peter Mutumosi and Jakson Muleka within six minutes during the second half doubled the lead to four goals and Nelson Balonga completed a surprisingly one-sided victory.
It promises to be much tougher for the Congolese in the second round, though, as they have been drawn against seven-time qualifiers Morocco.
Cameroon, the 2000 Sydney football gold medallists, Equatorial Guinea, Ethiopia, Guinea, Kenya, Malawi, Mozambique, Niger and Sudan also reached the second round.
After three qualifying rounds, seven survivors join hosts Egypt at a tournament next November and the top three finishers will go to Japan for the finals.