Ok, I've been running into a very similar problem. Whenever I get an erection, I can feel a sharp pain at the base of my penis. It's located in the actual shaft from what i can tell, and it's right above where the testes hang. It last for about a minute, but it frequently occurs when I have an erection hours after masturbation. I don't know if it's an irritation or an infection or what it is. But it's painful. After having an erection it'll normally go away the first time, and erections thereafter feel a little more normal. It makes urinating irritating as well when I wake up in the morning.