Airline will require an onward ticket before you even board the plane. You can insure that ticket, show it to immigration, cancel the flight and have two years or so to use it, wherever, depending on the airline.
My wife bought an external battery for her phone here in the USA. Got through Thai immigration just fine. On the way home, Thai immigration threw it out right in front of us.