We stayed in Bangkok last summer and had a lot of problems to find long distance trains in the dates and conditions we expected (ten days in advance). So, in Songkran may be near impossible to find a train ticket if you don’t book it in advance.
There is a website where the Thais use to book his train trips (but according to the first comment, that’s not true, you can’t buy train tickets online), but we just used this website to check the timetables, so I cannot give you an advice about if it works or not. Theoretically you can buy e-tickets there.
Alternatives: If you cannot find a website that allows you to book train tickets in advance, you may go to the bus station and try to buy a bus ticket when you arrive to Bangkok (ASAP) or you can try to buy short distance train tickets (sold the same day only from the station where the train starts the trip). Anyway, these options are slower and you will need more than one day to achieve your destination.
Credit:stackoverflow.com‘