One mid-June night in 2008, in a park in San Francisco, something much stranger than the usual is taking place: “At the top of the hill, just beyond the threshold of ordinary senses, a door was opening in the earth ...”

So begins Chris Adrian’s third novel, which, like its setting, contains one world on the surface and another buried deep inside, the two as intricately overlapped as a palimpsest, two stories written back to back. On one side, the history is terrible; on the other, beautiful. Or is it the other way around?

In a shimmering, shape-shifting take on “A Midsummer Night’s Dream,” Adrian imagines the fairy kingdom and the mortals who stumble into it by way of Buena Vista Park. “The Great Night” refers to a celebration the fairies have held each summer for a thousand years, marking their King’s defeat of the Beast, the fairies’ arch enemy, a malevolent entity more devil than sprite, now collared and doglike and renamed Puck.

Less a retelling of Shakespeare’s comedy than its jacket proclaims, Adrian’s book is more like the play’s dark twin, where Puck is borderline psychotic, Titania and Oberon have gone through an unofficial divorce and the mortals who enter the forest are three damaged souls making a last-ditch attempt to leave their broken hearts and lives behind.

As the book opens, the once-lively procession emerging from under the hill is muted. We learn of the death a year earlier of the royal couple’s beloved changeling, Boy, from leukemia, and how Titania drove her husband away out of grief. Now, her sadness compounded by his continuing absence, she makes a fateful decision: Knowing that if Puck goes free, Oberon will have to return to save his subjects and queen from the spirit’s 1,000-year-old wrath, she unbinds him with a single word.

The park’s borders magically close and the chaos that ensues as the Beast prepares to murder immortal and mortal alike sweeps Henry, Will and Molly along with the fairies as they take refuge deep in their underground kingdom.

Wandering through the corridors of the fairy palace, each human reflects, in interlocking back stories, on love gone wrong, dysfunctional childhoods and a series of mystifying and shared links to the world they now traverse.

The longer they spend in the newly visible realm, the more the threesome wonder just how much of it can be chalked up to their imagination and which parts are terrifyingly real. Which, Molly wonders, is “a more extravagant effort on the part of her demented imagination, a man with no pants on or a tiny grandpa in a nice suit or a boy with a bunny tail?”

“Mortals!” the fairies snort. “They always think it’s a dream!”

Adrian, who grew up in Florida and is a graduate of Harvard Divinity School, works in San Francisco as a fellow in pediatric hematology-oncology. He is the author of two earlier novels and a collection of short stories, “Gob’s Grief” (2001), “The Children’s Hospital” (2006) and “A Better Angel” (2008).

The fantastical elements in his work attempt to explain the inexplicable: the death of a child, a groundless self-loathing, the suicide of a sibling. Black humor goes hand-in-hand with crushing sorrow and sexual debauchery sometimes offers the only relief. Only through the commingling of two worlds, fairy and human, can Adrian’s very mortal beings confront their worst fears, the mistakes they’ve made and, most frightening of all, their own personal demons.

It’s up to the reader to decide whether it’s all a dream, or if we humans just don’t get it.

Shakespeare is not the only inspiration for “The Great Night.” Its phantasmagoric mash-up draws from many a children’s story, including elements of “Peter Pan,” “Alice in Wonderland,” “The Wizard of Oz” and even “Oliver Twist,” not to mention a smattering of R-rated Hieronymus Bosch. There are orphan thieves on bikes who report back to a modern-day Fagin and lost children who reappear out of nowhere, coated with fairy dust.

But the most affecting chapter is Adrian’s alone, an account of the days when Oberon and Titania, baffled by their Boy’s affliction and knowing he’s human, surrender him to the children’s ward of the nearest hospital.

In heartbreaking scenes where the fairies redecorate the child’s room with soft grass and jewels and “a cover of clouds to hide the horrible suspended ceiling,” his royal parents struggle to comprehend the jargon of the oncology ward, their bafflement no different than any human parents’ in any hospital confronted with the frightening specter of a child’s illness:

“The chemotherapy came in colors — straw yellow and a red somewhere between the flesh of a watermelon and a cherry — but did not fume or smoke the way some of [Titania’s] most dramatic poisons had. There was nothing in them she could comprehend, though she peered at the bags and sniffed at the tubes, since there was no magic in them.”

One sad night, as the royal couple tries desperately to rekindle their own love in the face of devastating loss, Titania, eyeing their fading Boy, reminds Oberon, “What a terrible gift you have given me.” Much like this spooky, tender and all-too-human book.

Fiction

“The Great Night”

By Chris Adrian

Farrar, Strauss and Giroux; 304 pages; $26