If, in the past, your cat has only displayed aggression due to the appearance or scent of another cat, then there's an excellent chance that he saw something outside or was still in a reactive state from having recently seen a cat through the window. If a cat sprayed outside your door, trust me, your cat smelled it. Cat urine is very strong. He may even have heard another cat outside.
So many times, cats are labeled as aggressive or diagnosed as displaying unprovoked aggression when the true diagnosis is actually redirected aggression. Before you petted your cat did you happen to notice anything strange about his behavior or body language? Was his tail puffed up or was his skin twitching? Did his ears appear horizontal? Were his pupils dilated? Any of these could be a sign that the cat was highly reactive. Once you know that your cat is vulnerable to redirected aggression, you just have to be a little more aware of his body language. A cat can stay aroused for hours, and just because you don't see anything outside that could cause him to get upset, it doesn't mean it isn't or wasn't there. I have a cat who displayed redirected aggression when a strange cat jumped up on the window and sprayed through the screen, so I'm more in tune with her body language. It has become second nature for me to observe the position of her ears and the size of her pupils. I also know that if I see a cat outside, I should close the blinds so Bebe doesn't get upset.
Also, anyone considering having her cat declawed, please have him checked out by the vet to make sure there isn't an underlying medical cause for the recent behavior. I'd hate to see a cat get declawed for an isolated incident.
More cat-care and behavior solutions: