You're correct, the crate is never to be used as a punishment. There are ways to condition dogs to love them and can be used for positive training opportunities.
If you catch him in the act, an abrupt, "uhuh" or "hey" can be used to interrupt him, then take him outdoors and reward him for peeing there.
Is your dog fixed by any chance? If he's over a year old, I would say he was marking your bed, perhaps because of the unfamiliar scents. If that's the only piece of furniture he pees on (if he's peeing frequently elsewhere indoors, your best bet would be to head to the vet clinic to rule out a urinary tract infection), you can always not allow him access to it.
"Education is a progressive discovery of our own ignorance." -Will Durant