Upvote:1
For the 30 day visa exemption you need to document that you are leaving Thailand before the 30 days are up. And the only real proof is an airplane ticket out. A bus ticket to the border does not count.
You will need to prove this first the airline flying you to Bangkok as they have the legal responsibility to check before boarding you. Immigration rarely checks unless you look slovenly or broke when you arrive. Because your partner's flight and your train trip are 31 days, you are safest getting a tourist visa before going, then the 30 day exemption when you return from Cambodia (or re-reading perhaps you are turning via Laos, but either way the same advice).