I can help you with the odor and urine stain removal. I have 2 good cheap recipes here that are for carpet urine stains and odor but I dont see why it couldnt work on your matress. The first one is good for getting dog vomit stains out too.
16 ounces hydrogen peroxide
1 teaspoon joy or dawn dishwashing liquid soap
1 1/2 tablespoon baking soda
Using a plastic container, mix the solution in order given, apply or spray a generous amount where needed. After a day or two vacuum. It works wonders, no stain, no odors. CAUTION: do not store leftover mixture, it will build up and can explode.
OR
1 quart water
2 tablespoons white vinegar
1 teaspoon liquid dish soap
Mix the ingredients in a pail, and use a scrub brush to brush the solution onto the problem spot.
Well, for starters, go to the pet store and pick up "nature's miracle". It's a product that cleans up kitty "accidents". The problem with normal cleaners is they don't get rid of the smell so that kitty can't smell it. Until you use this, it's still a "make spot" to kitty.
I would, however, advise putting a plastic cover on the mattress until this problem goes away (if it does, sorry kitty is so ill!). Mattresses are heck to get clean from kitty accidents, their very nature makes it hard to get rid of the smell. I hate to say it, but you may want to consider at some point replacing it, if it got peed on badly. This will at least prevent more damage. Treat the spots with the above product liberally, let it dry, and then put the plastic sheet on. Put whatever sheets/beddings on top of that so you don't feel the plastic.
Otherwise...with a sick cat, its hard to tell what's causing the behavior. It could be pain related...and then when the pain is passed, the smell could be causing instinct to kick in...and then after the smell is gone, it could have become learned bad behavior.
*sigh*. A real problem, eh? Well, I will say that I've never met a cat that liked using a covered litter box. Your cat's reaction seems to be classic. Most object to the idea of going to the bathroom in a "cave". It's too bad, it's a great idea, in human terms. :)
I'd say do the clean up, and see how it goes from there. Let me know how it goes.