Cold is more for pain since it has more temp numbing qualities. They both can be used for recovery though.
It's really all up to you. I would apply something like a heating pad, rice sock, or some type of heating device (if it gets too hot, apply a thin cloth layer between you and the device) for around 5-10 minutes. Then use something like an ice pack/ice cubes wrapped around a cloth (to soak up from melting and making sure it's not too cold) for up to 5minutes. Then repeat this for a few times, as long as you have the time to do so.
With cold therapy, there is a point in which doing this can cause pain if it gets too cold. I would alternate @ that point if you reach it (but try to avoid it).
I wouldn't keep it on (cold) to the point where it starts stinging. I did this same method for a stubborn inflamed acne cyst, but I left an ice cube on my face for around a minute and was left w/ a large whelp and redness that didn't subside until an hour later. The coldness also prompted a pain that felt just like a paper-cut (which is a stinging nerve pain w/ residual throbbing). Just try to avoid this all-together.
Maybe someone will get back to you on how to do it in a more proper form. I only had 1 injury from PE and that was years ago. I didn't do any of the above.