You can purchase Rubles in a few banks outside of Russia, but to get the discount, you are talking many thousands of dollars at a time. It's the way of International commerce, but I doubt anyone will sell you a few hundred dollars worth of RU on a one-time basis.
As Jet suggested, use the ATM machines as your primary source while in Pieter, however I also suggest you take some cash money with you in clean, crisp, fresh bills, perferably in $50's and $100's. Be sure to remember that Russia controls the money coming in and going out pretty carefully, so you will have to declare how much cash you bring in when you arrive and you will have to account for it when you leave. If you get extra cash from the ATM while you are there be sure to save the receipts so you will have a record of where you got it, and thus be able to account for where the money came from when you leave. The customs guys at the airport have never failed to ask me how much money I had left when I was ready to board my flight home. They can put two and two together as well as any other cop and if you try to leave with more money than you arrived with, well,,, in their mind you will have been up to no good. The Russian criminal mafia tries to smuggle dollars out of the country all the time, so be prepared for the question.
Just a word to the wise.