I can't give any advice for electric shaving, cause I won't do it...but I have a problem area at the nape of my neck and my crown grows funny. My advice here is pretty simple...but it's very important.
DON'T PRESS HARD
Pressing down more with the razor doesn't cut hair better, it tenderizes your scalp, which will give you the ouchies. I can shave my head for 15 minutes if I want...I keep it well lubricated (I use SOAP, not even shaving cream/gel anymore) and pass LIGHTLY over my head. It's a RAZOR we're talking about. If you pass it over the hair at the right angle, the super sharp blade will cut it. The same is said about your head if you press down too much.