To be honest, for the shorter rail journeys such as Bangkok to Chiang Mai, you don't need to book beforehand. Between Bangkok to Phuket you should know that there's no direct rail line; rather, there's a train to Surat Thani and then from there you have to travel by bus / minibus. For the overnight sleeper trains, as Peter mentions in his answer, you may want to book tickets a couple of days in advance once you reach Thailand as these tend to be popular among travellers who want to save a bit on accommodation for a night. (There are a couple of overnight trains from Bangkok to Chiang Mai which are popular ones.)
It's not that hard to book tickets at the station in when in Thailand, as long as you are willing to be a bit patient with rail officials who don't speak English (and there are many who don't). You will usually find some official or police officer or the other who can direct you to what counter to book your tickets at - sometimes, you need to book at different ticket counters depending on your destination.
Trains do get fully booked around holidays such as Songkran but that's celebrated in April. If I remember correctly from your previous questions you're travelling in February / March (?), so this should not be a problem for you.