Here is a site that provides some good information om train travel in Thailand (and elsewhere):
How to travel by train in Thailand - a complete guide
I have no experience traveling with train in Thailand, however, I have found that the sleepers on the Malaysian trains tend to sell out.