The world No. 2 US won the opening set 25-19 but 12th-ranked Thailand came back strongly in the following two sets, 25-19 and 25-20, amid cheers from more than 6,000 spectators packing the Hua Mark Indoor Stadium in Bangkok.
Thailand needed just one more set for the victory, but the US came back to take the final two sets 25-12 and 15-10 to clinch the match.
The Thai team will meet World No. 1 Brazil at 4.30pm on Sunday in the FIVB World Grand Prix, with the top six of the 28 teams competing worldwide to advance to the finals in Tokyo on Aug 24.
"We’ve learned a lot from this game. I have to thank USA team for showing their spirit," Thailand coach Kiattipong Radchatagriengkai said after the match. "We will improve our team for the better. Finally, I wish the USA success in their upcoming game."
"I am very proud of my team despite the 3-2 loss. They tried their best," said Thailand captain Wilavan Apinyapong. "I want to keep today's experiences as a good lesson for future improvement."
USA captain Alisha Glass saluted the "great spirit" of her thai opponents. "We competed really hard. Thailand came out at us really strong and we bounced back. It was a whole team effort."
Thailand so far has just two victories against six defeats. They upset seventh-ranked Serbia in South Korea two weeks ago and followed that up with a win over the Dominican Republic in Bangkok on Friday.
In the other match in Bangkok on Saturday, Brazil blanked the Dominican Republic in three sets (25-19, 25-11 and 29-27).