During most of her long writing career, Margaret Irwin (1889-1967) was best known as a historical novelist, setting much of her fiction in Elizabethan and Stuart England. “Young Bess,” for instance, focuses on the early years of Queen Elizabeth I (and was made into a 1953 film starring Jean Simmons). But to devotees of the weird tale and the ghost story, Irwin is also remembered as the author of two frequently anthologized short classics, “The Book” and “The Earlier Service.” Both are deeply frightening and quite unforgettable, no matter how hard one tries. The pair, along with several other unsettling stories, were eventually collected in the now scarce 1935 volume, “Madame Fears the Dark.”

As it happens, Irwin’s first book, “Still She Wished for Company,” blends the historical and the supernatural in one of the pioneering works of paranormal or time-slip romance. First published in 1924, it enters the public domain this year and makes for a delicious, if bittersweet, Valentine’s Day treat.

The novel is divided into three sections, “Time Is,” “Time Was” and “Time Will Be.” (The phrases are those of the medieval alchemist Roger Bacon.) “Time Is” introduces the reader to Jan, who works in contemporary London and has always been given to dreaminess and distracted reveries. While a nice young architect named Donald wants to marry her, Jan feels hesitant, mainly because of an 18th-century painting titled “Gentleman Unknown.” As a schoolgirl, she found herself almost mesmerized by the portrait, eventually clipping a reproduction from a magazine and pinning it to her bedroom wall. The sensible, down-to-earth Donald can hardly compete with this commanding, dashingly Byronic heartthrob, who Jan imagines as “a man of easy, ironic wit, assured composure impossible to ruffle” and receptive to “fancies as fantastic as her own.” What does it matter that he lived more than a hundred years ago? Her heart still yearns for him or someone like him.

At the end of “Time Is,” Jan is about to spend a five-week-long holiday in the country near a somewhat rundown manor house. At this point, the novel switches to “Time Was” and we find ourselves in 1779, where we remain for the next 250 pages. Young Juliana Clare is 17, exceptionally pretty and, like Jan, susceptible to moments of hallucinatory second sight. This isn’t so surprising since her ancestors included a seductive witch and a religious mystic. Juliana, though, is eager to escape the tedium of aristocratic country life. Her mother actually wants her to marry the dull, widowed, 38-year-old Mr. Daintree, whom she has known since childhood! Admittedly, he has kindly eyes, but still the man is so old.

Suddenly, Juliana’s romantic ennui is interrupted by the reappearance, after an 11-year absence, of her scapegrace oldest brother. Since their father’s death Lucian has become Lord Chidleigh, much to the irritation of his siblings George and Vesey. Though only 26, this prodigal son is rumored to have once led the notorious Hellfire Club, whose members supposedly worshiped both Satan and Venus. During a grand tour of the continent he is said to have sampled every known vice and perhaps some unknown ones, too. In Paris, for example, Lucian apparently associated with the occult magus Alessandro Cagliostro and the reputedly immortal Comte de Saint-Germain.

In looks, Lucian is by no means conventionally handsome, though always faultlessly elegant. His “eyebrows were peaked just at the corners, which gave his face a slightly crooked look, rather like the stone satyr on the terrace . . . His mouth, too, curled up at the corners even when he was not smiling. His head was generally bent a little, slightly on one side, which gave him the appearance of one who was watching, or was it listening?” When he wishes, Lucian can be witty, debonair and irresistible to any woman upon whom he casts his strangely magnetic eyes. For some reason, he is particularly interested in Juliana.

At first, the reader suspects Lucian of incestuous desire for his sister, but Irwin — though never wholly dispelling an air of eroticism in their relationship — gradually makes clear that Juliana is needed for an even darker purpose. In the family library, Lucian conducts experiments involving his sister, which she afterward can never remember clearly. They begin with some kind of incense, often employ a bowl of ink or a sheet of clear glass and seem to be dominated by Lucian’s powerful, hypnotic gaze. When she emerges from the library, Juliana sometimes feels that she’s been sleeping for a hundred years. Sometimes, too, the grounds outside the house briefly look different, unkempt and neglected. More disconcertingly, Juliana gradually begins to glimpse, more and more often, a bizarrely dressed young woman roaming the estate, whom she doesn’t recognize. Of course, the reader does: It is Jan.

Should I tell you more about what happens in “Still She Wished for Company”? I think not. Let me just add that Lucian eventually confesses that since childhood he has been in love with a woman he has only seen in dreams or moments of vision. For years he has been focused on finding that woman, wherever she may be, whenever she may exist. It’s also just possible that she has been looking for him.

But what would you sacrifice for a dream? In the end, Juliana remains the linchpin in this beautifully written novel about love, yearning and the brevity, not just of our lives, but of the very memory that we once lived. Nonetheless, Irwin brings her story to a haunting, poignant close in “Time Will Be,” as time itself is abolished: “Now, or a hundred years ago or a hundred years hence, it was all one. Wherever they were, whatever they would become, something of them both would always walk together at this summer hour on the terrace.”

Michael Dirda reviews books each Thursday in Style.

STILL SHE WISHED FOR COMPANY

By Margaret Irwin