Those are good suggestions. I always feel if a cat - or any animal really - does something like this that is totally out of the ordinary, it is some kind of attempt to communicate that something is wrong. Or at the least, that something has changed in their environment that is very important to them.
I wonder if in going outside recently your cat encountered something he feels is a territorial threat, such as another cat in the neighborhood that has presented dominating behavior. I believe cats spray largely in order not only to mark, but to claim territory as theirs. This sounds like a real nervous cat, about something!