The link clarkey gave you is definitely your best guide but a few broad truths. The tickets are a lot cheaper if you buy them in person at the station in Moscow. This is a painless process if you speak Russian or know how to ask for a return and can say dates. If not you should use a travel agent because 1) it is a really popular route so tickets can get booked quite far in advance and 2) as with everything in Russia - if you can minimise the hassle in any given situation you should.
I would suggest you take the overnight train and book into a coupe (4-berth cabin) as you meet a lot of interesting people and it's a nice journey. I am assuming you've never been on a long-distance Russian train before but they're pretty impressive in terms of what you pay for the experience. Also they ALWAYS run on time. The mainline station in Moscow is usually heaving so leave yourself plenty of time to get to the platforms, which are a bit of a walk from the metro. Also the benefits of using a travel agent are that your itinerary should be in English so if you don't speak Russian you may find it easier to navigate your way around the platforms.
Have fun it sounds like a great trip and St Pete's in the winter is pretty spectacular; even Moscow looks nice in the snow.^