Kim, who won gold in the men's team event on Saturday, was tipped to vie with his compatriots for the individual title but was devastated after succumbing to a 6-2 loss on a breezy afternoon at the Sambodromo.
Ega Agatha, a 24-year-old from Surabaya in eastern Java province, lost the opening set but stunned 24-year-old Kim in the next three, slamming the door shut with two brilliant shots that landed flush in the gold target for two perfect scores.
Riau Ega Agatha (INA) of Indonesia competes
Image credit: Reuters
Chang claims women's individual gold for South Korea
As a modest crowd in the terraces roared, Kim slumped with his head down while his team-mates looked on in dismay.
Ega Agatha flashed a huge grin and high-fived his coach after setting up a match with Italy's Mauro Nespoli in the third round.
South Korea restore order with men's team gold
Brilliant Kim sets 72-arrow world record