Admit it: you've felt it, too. Let's say you've climbed to the observation deck of a tall building, or tiptoed to the edge of a high cliff. Or perhaps you're on a ski lift, dangling far above the ground. And that's when it arises - the mysterious urge that Edgar Allan Poe, who wrote about it best, calls "a cloud of unnameable feeling". What if you jumped? You don't want to die, of course; you're feeling generally good about life. Yet the urge is real: as Poe writes in his story The Imp Of The Perverse, it "chills the very marrow of our bones with the fierceness of the delight of its horror". Acting on it would be catastrophic. But somehow it's that very fact that makes it so seductive, and so strong.

The imp is at his worst in situations involving the risk of death - is any driver immune to the idea of swerving into oncoming traffic? - but hardly confines himself to them. "Anytime I am around a large body of water such as a river, lake or ocean, I feel tempted to throw my BlackBerry in the water," admits one contributor to purgetheurge.com, a squirm-inducing site dedicated to the phenomenon. In hushed theatres, I have to fight the desire to yell out loud; the sheer ease with which I could ruin things for hundreds of others makes me giddy. A recent paper in the journal Science suggests these fantasies are near-universal, but usually resisted - though we're more likely to act on them when highly stressed. As Poe observes, procrastination sometimes works this way, too: "The most important crisis of our life calls, trumpet-tongued, for immediate energy and action... and yet we put it off until tomorrow; and why? There is no answer, except that we feel perverse."

This ubiquitous idiosyncrasy in our wiring seems to have little connection with suicidal thinking: the whole force of the urge comes from how much we don't want the results it would bring. So might it serve a purpose - could it be, in computing parlance, a feature, not a bug? Toddlers develop into autonomous, well-functioning selves by testing boundaries. Might this be the adult version? Perhaps it's useful to come face to face with what we could do if we chose, then choose not to. (Additionally, as the philosopher David Copp points out, "The more powerful we imagine the urge to be, the stronger the reason it gives me to back away from the edge [of the building]." Ironically, the urge may be protective.)

This is the one sense in which Poe's description of the attractions of perversity isn't true to life: his characters, plagued by the desire to commit awful acts, actually commit them. The narrator in The Imp Of The Perverse explains how he carried out what ought to have been the perfect murder. For years afterwards, nobody suspects him, and he secretly revels in his achievement. But then, one day, a thought occurs: "I am safe - yes - if I be not fool enough to make open confession!" Immediately, a chill creeps over him, and the urge to confess starts gnawing at his soul. He isn't suffering a crisis of conscience: the only thing driving him to reveal the truth is how disastrous it would be to do so. He does so, and is sentenced to hang. He is telling his story, he reveals, from a prison cell. The imp wins out.

oliver.burkeman@theguardian.com