We had a 2-day stopover in St. Pete's last year while we on our Baltic Cruise.
It may be that since we were on a cruise ship, the rules were different, but we could not get through passport control without having a valid on-shore tour ticket (from the ship) or used an authorized private shore (pre-approved) tour guide.
You could not just get off the ship and "walk around town" on your own.
If you are on an internal river cruise, the rules may be different outside the "big cities", but you should have that info from your tour company or travel agent. BTW, a separate visa was not required, but of course a valid passport was.