Although my wife prefers to take the overnight train between Moscow and St Petersburg, I find them to be uncomfortable. Most of our clients prefer the daytime train (as mentioned above) or to fly.
The best way to buy the tickets is through your hotel concierge or from a travel company which does business in both countries (although the fees might be higher). Safety isn't really an issue on any of these trains (although you do have to be cautious in the train stations, and I recommend that you get your hotel to arrange a transfer between the train station and hotel).
Marc David Miller
[email protected]