When it is best to visit Bangkok is wide open. You can really go at any time. If you don't want to get wet during the monsoon season, you should go anytime from late November to early December. The rains cool the town down and it will still be a little too early for the holiday tourists to be arriving. Some like going during the monsoon time, though. However. September and October are the very rainiest months of the year there in Bangkok. If you are going for the awesome beaches, December to March will be your best bets as the weather accomodates with sunny days and warmth. You aren't as likely to get rained on either.
The best time to go to Bangkok really depends on what you plan to do when you get there or if price is a big factor. The most expensive time to go is over the holidays because that is the very busiest time there for tourists to go. Really, any time is a good time to go to the City of Angels, according to most.