assuming this tale is genuine, a little common sense goes a long way. at immigration never draw attention to yourself, just be another tourist arriving. only speak of spoken to, remain calm and polite at all times. if an IO behaves in any way unprofessionally to your detriment calmly and clearly ask to speak to a superior.
personally, i've never had any issue with a thai IO, those i have seen having issues have always been brought about by their words, actions or behavior, or the words, actions behavior of their thai partner! that's tip 2, go alone.