As long as you're not from a country that requires in-country visa applications (India and China mostly), you can apply for a tourist visa at any Thai embassy in the world. The 9 month Special Tourist Visa, 6 month multiple entry tourist visa (which isn't currently being issued), and the Non-OA are the only 3 visas that can ONLY be applied for in your home country or country of legal residence.
Anywhere, you need a ticket leaving Thailand within the period of time you'd be permitted entry to. If you're entering on a 30 day visa exemtion, you need a ticket leaving THailand before that 30 days would expire.
Book a refundable ticket, cancel it once you enter Thailand. Immigration doesn't care, normally it's the airline that will refuse you boarding.