@Phil *****
You have to stamp into another country. So you stamp OUT of Thailand, arrive in another country, cross their passport control to "enter" that country, then you can return to Thailand. If you show back up at passport control and they see you never entered another country, they consider it that you never really left.