Chris Adrian is a fellow in pediatric hematology-oncology. He is also a recent graduate of the Harvard Divinity School. So he’s well-versed in tragic loss and grief, as well as the more abstract issues of immortality and the meaning of life. In his newest novel, The Great Night, he mixes all of these ingredients together and bakes them in an oven fueled by Shakespeare’s A Midsummer Night’s Dream. The result is an exquisitely heart-breaking novel, sprinkled with dark comedy, whimsy and sex.

The fairies of Shakespeare’s comedy — Oberon, Titania, Puck et al — have been transported to a park in modern-day San Francisco; the intruders into their realm are no longer Athenian youths and bumblers, but local citizens. Mr. Adrian lives in San Francisco, and his affection for the city suffuses the novel. He makes it effortlessly obvious that if, indeed, the fairy world were to intrude into modern times, it would simply have to be in San Francisco. His rendition of the city is a little Armistead Maupin, a little Christopher Moore, and a lot of melancholy.

The premise of The Great Night is fairly straightforward, compared to the play on which it riffs. On Midsummer’s Night, several miserable San Franciscans wander into Buena Vista Park just as Titania, grief-stricken over the death of her changeling son and her estrangement from her husband, releases Puck from bondage. In this story, Puck is not the least bit puckish; he is an ancient and terrifying demon, hell-bent on death and destruction.

The mortals are a motley crew. The three main protagonists are as dejected and rejected as is proud Titania. They stumble through the suddenly-bewildering park, and are Shanghaied by eccentric-looking fairies who take them underground to protect them from the demonic Puck; here they encounter each other, which does nothing to ease their bewilderment; at last they encounter Puck and the Fairy Queen herself. To tell you that much is to give away nothing, for the novel’s depth and impact spring from its intricate back stories, which Adrian unfurls with gorgeous detail and deft language. The novel leaps around through time and history with the perplexity of a dreamstate. The farther the characters move underground, the more their stories weave together in subtle, moving and unexpected ways. One of these mortals, ultimately, has a date with Destiny tonight.

The overwhelming emotion of the story is deep sadness. But — à la A Midsummer Night’s Dream — Adrian is fascinated by the intersection of the mundane and the extraordinary. As a narrator, he remains poker-faced presenting gallows humor: Oberon and Titania out of their element in a pediatric cancer ward, where their “son” succumbs to leukemia; one mortal dismissing the others as her own personal delusions; a halfway house for changelings ejected by the Faerie World; and above all, Adrian’s version of the “rude mechanicals.”

In the original, this group of laborers meets in the woods to secretly rehearse a play that will honor a royal wedding. They are the comic relief even within the comedy, and their counterparts here add a note of levity to the pervasive sorrow of The Great Night. Huff and his friends are homeless advocates, who are secretly rehearsing a “guerilla theatre” musical adaptation of Soylent Green. (They intend to perform this for the Mayor, to shame him into admitting that he’s killing homeless people and feeding them to other homeless people.) Huff is obsessed with this project. His cocky monomania makes him impervious to fear or even confusion; he is as obnoxiously endearing as his Shakespearean counterpart, Nick Bottom. Both men are bound magically to Titania in slyly similar yet dissimilar ways.

In many ways, this novel is Shakespeare adaptation at its best: Adrian makes no attempt to one-up the original material, but instead borrows what suits his fancy and uses it to show us the shadowside of fantasy and yearning. The prose is rich and measured, and the story is both heartwrenching and heartfelt.