I love the ancient Mesopotamian Epic of Gilgamesh, which is mysterious, raw, brutal and profound. But I am also haunted by the story behind the story; by the fact that Gilgamesh lay forgotten in the sands of Iraq for thousands of years. Unlike other lost books that we know went missing – Ovid's Art of Love, the second part of Gogol's Dead Souls – Gilgamesh was, to quote D Rumsfeld, an unknown unknown: nobody knew it had even been there. The idea of this invisible literature, lurking in darkness, fascinates me.

Another such book – very far from Gilgamesh – is John Kennedy O'Toole's Confederacy of Dunces, about a fat slob called Ignatius J Reilly, who feels he doesn't belong in the world. Its invisibility was not the result of the collapse of the civilisation that produced it, but rather its rejection by American publishers. Devastated, O'Toole eventually committed suicide – but thanks to his mother's persistence, Confederacy was published 11 years after his death, won the Pulitzer prize and has since sold millions of copies worldwide. Today, it's a canonical text of southern literature.

Some countries provide better conditions for the generation of unknown unknowns than others. Totalitarian communist dictatorships, with their high levels of literacy and low levels of freedom, are ideal. Daniil Kharms (1905-1942), who lived in Stalin's Russia, is a fine example. During his own lifetime he was known as a children's author; his bizarre, adult tales of death, disappearances and random violence unknown to all but a close inner circle. Kharms starved to death during the Leningrad blockade of 1942. His texts would have vanished if a friend hadn't risked his life to rescue them. They first surfaced in the west in the 1960s and were published in Russia in the 1980s. Now festivals are held in Russia in honour of books that for 30 years nobody knew existed.

Two years ago in a Moscow bookshop, I stumbled upon an author whose retrieval from oblivion was even more unlikely. Sigizmund Krzhizhanovsky (1887-1950) was a polymath from Ukraine, who moved to Moscow in the early 1920s to pursue a literary career. Living in a tiny room in a communal flat, he dedicated himself to writing stories so alien to his era that he didn't even bother showing them to publishers. Krzhizhanovsky published the grand total of one story in his lifetime, then more or less vanished. He was finally discovered in the 1980s by Vadim Perelmuter, a literary scholar who was studying the diary of Soviet poet Georgy Shengeli, who was renowned for the contempt in which he held his contemporaries. The day Krzhizhanovsky died, Shengeli lamented the passing of "a writer-visionary, an unsung genius". So rarely did Shengeli say anything nice about anybody that Perelmuter was moved to discover who this lost "genius" was. The result is a multi-volume collected works, currently being published in Russia.

NYRB classics recently published Memories of the Future, a selection of seven of Krzhizhanovsky's long lost tales. The first, Quadraturin, is about a man living in a communal apartment who is supplied with a mysterious substance which, when applied to the ceilings and walls, vastly increases his living space. Although at first the protagonist enjoys this, the room begins to stretch off into infinity. Eventually it grows so large that he becomes lost in the immense darkness, and cries out in vain for help. Alas, writes Krzhizhanovsky, "for a man who is lost and dying in the wilderness to cry out is both futile and belated".

The other stories are no less dark, or strange. In The Thirteenth Category of Reason, a chatty corpse misses his own funeral; in The Branch Line, a passenger boards the wrong train and travels to a place where night is day and an army of "dream workers" plot to supplant reality with nightmares. And yet these phantasmagorical, philosophical stories are grounded in the streets and rooms Krzhizhanovsky inhabited. I ate many an overpriced burger in the building where he lived (today it's Moscow's Hard Rock cafe); just round the corner is the bench on which the protagonist of his story The Bookmark meets a spinner of demented tales.

Eventually Krzhizhanovsky succumbed to despair and stopped writing, choosing instead to compose his narratives in his skull. Even those works that were written down, however, feel internal, hermetic. Clearly Krzhizhanovsky expected to remain unread, and so could be as dense and complex as he wished. But if the stories are not always easy to follow, they're always worth the effort. The same cannot be said for most unknown unknowns, which are probably better off lost. There are far too many books in the world as it is.

Speaking of which, it occurs to me that, thanks to the internet, there are several ways to be lost new to our era. Think of all those unread blogs floating in the depths of cyberspace, or worse, the novels on print-on-demand sites, where the demand never comes. The suicide's book left in a drawer, or lost forever in a Soviet archive, has pathos at least.