Explanations of responses to real graphic harm
I'm not an expert in social cognition and this may be considered somewhat speculative, but I wouldn't be surprised if the literature found a link between shocking images and their high informational value (along the lines of a delta in reinforcement-learning models).

Intuitively, one would expect that visual representations of potentially dangerous situations would be extremely informative and therefore extremely salient.  Indeed, emotion-induced blindness studies suggest that gory stimuli benefit from the deployment of massive attentional resources, to the point that they may exclude other salient stimuli.

Where this gets speculative is why this is experienced as something pleasurable.  I'd suggest that highly-informative stimuli might be pleasurable in general.  On the pure social psychology end of things, a search for "morbid curiosity" is bound to turn up some relevant results (as suggested by @medica).

I'll leave it up to you to explore these three bibliographic trails. =)