Our Jasper has had a few incidents with partial urinary blockages caused by crystals. I know how frightening this is and am happy to hear you got your guy to the vet in time.
Thankfully, we've always noticed weird litter box behavior in time to get him help. Sometimes it is peeing outside of the box, others it is repeatedly going to the box and not being able to pee. His crystals are caused by stress. Great, right? So, we have to be sure to keep household stress levels low.
We do give him a bit of extra water in his wet food (that's all we feed our cats) and most importantly, we count the pees and poops in the litter box everyday. It's one of the easiest ways to detect if there is a potential problem.
Thanks for publishing this story. Maybe it will help others avoid serious problems.