Rats in the commode are not an urban myth; nor, apparently, are they limited to basement apartments. Gothamist.com reports on a 3rd floor toilet rat incident in Prospect Heights (the rat made it from bathroom to living room, then vanished). The post offers up some handy advice for anyone dealing with a similar plumbing invasion.
Rule #1: Should you find a rat in your toilet, the first thing you should do is flush it back down. "It happens all the time," an exterminator tells Gothamist. "They call me, I go in, and just flush the toilet. 100 bucks!!"
If for some reason the flushing should fail, try squirting some liquid dish soap into the bowl (just prior to slamming the lid shut). The soap is said to degrease the oils in the rat's fur so it can no longer swim.
Longer term fixes, besides moving, include finding and fixing broken sewer pipes, and, according to some of Gothamist's commenters, putting wire mesh over the plumbing vent pipe that opens to the outside, usually on the roof.