Ricks' Northern European Cruise Ports book is great. However, as far as I could see, in his St. Petersburg section he only talks about the first two options below, when there are actually three:
1) Taking the ship's tours. For these, you do not need a visa.
2) Touring St. Petersburg yourself. For this, you do need a visa arranged in advance.
3) Taking a tour with one of the companies that gets a "visa equivalent" for you. That's not the official term, but "visa equivalent" is indeed what it is. You send your passport information to them in advance, and you don't need to get a visa. These companies offer small group tours (smaller and with more varied options than the ship tours), as well as more private tours for more money. With these, you do not need a visa.
Some of the companies that offer option 3 are DenRus, Red October, SPB, and Alla Tour. You can look at their websites and see if one of their packages suits your needs, or e-mail them to ask what they can do for your group.
The other port that is a potential "issue" on your own is Rostock/Warnemünde for Berlin. Berlin is about 3 hours from the ports, so seeing it on your own is dodgy (although people do it). Otherwise, getting from the dock to your city is usually easy, and the cities are not hard to see on your own (armed, of course, with Rick's book).
However, if you do want excursions for other Baltic ports, the companies I listed have them, and often offer a discount if you are using them for more than one tour.
You can learn more about your trip on Cruise Critic. Here's their Northern Europe and the Baltics Ports Forum: http://tinyurl.com/by57g9z, which will have more info on all your ports.