In June 1764 a 52-year-old man awoke from a strange dream. He was sleeping in his own house, recently radically rebuilt, in Twickenham by the Thames. In his sleep he had thought himself, he later wrote to a friend, in “an ancient castle”. There, “on the uppermost banister of a great staircase”, he had seen “a gigantic hand in armour. In the evening I sat down to write, without knowing in the least what I intended to say or relate”.

strawberry-hill128The resultant book changed literary history – we are still reading its remote fictional successors today – and the house in which it was dreamt, which was just as much the creation of that middle-aged dreamer, profoundly altered the future course of architecture. The man was Horace Walpole and the building was his villa, Strawberry Hill. Both are the subject of an exhibition at the V&A (Horace Walpole and Strawberry Hill).

It will put back in the spotlight an extremely unusual man. Horace Walpole (1717-97) was the youngest son of Sir Robert Walpole, Prime Minister for much of the early Georgian period, and one of the great power brokers and wheeler-dealers in British political history. Horace – superficially at least – could scarcely have been more different.

He doesn’t seem to fit in the rational and measured 18th century at all, his tone of voice can be closer to Oscar Wilde or Max Beerbohm. His epigrams have a distinctly Wildean ring: “The world is a tragedy to those who feel, but a comedy to those who think”, for example, or: “The whole secret of life is to be interested in one thing profoundly and in a thousand things well”. His description of Twickenham: “Dowagers as plenty as flounders inhabit all around”, could have been uttered by a character in The Importance of Being Earnest.

His style and manner, on the other hand, bring the late Kenneth Williams more to mind. His friend Laetitia-Matilda Hawkins described the “high gentlemanly tones” in which he spoke, and his idiosyncratic way of walking: “He always entered a room … knees bent, and feet on tiptoe, as if afraid of a wet floor.” Nothing is known of Walpole’s actual sex life, which some biographers believe to have been non-existent. But his quarrel on the Grand Tour with his friend, the poet Thomas Gray, has been interpreted by others as a lover’s tiff.

There are aspects of Walpole that bring the word “camp” irresistibly to mind. The cult he made of his domestic animals, for example. In a recent book, Horace Walpole’s Cat, Christopher Frayling remarks: “In many ways Walpole’s pets – dogs and cats – resembled Sebastian Flyte’s teddy bear Aloysius in Brideshead Revisited, or animate versions of Linus’s blanket. They were indeed the recipients of more genuine affection than all but a very select few of his friends.”

When in February 1747 Walpole’s tabby cat, Selima, had a fatal accident in one of Walpole’s prized Chinese ceramics it became the cue for mock-tragic poetic lament, “Ode on the Death of a Favourite Cat, Drowned in a Bowl of Gold Fishes” by Gray. This in turn was illustrated by another friend, Richard Bentley, published to huge success and subsequently also illustrated by William Blake.

Walpole has often not been taken seriously by posterity, precisely because of his apparent lack of seriousness. To the earnest Victorian historian, Macaulay, he was, “the most eccentric, the most artificial, the most fastidious, the most capricious, of men”. Yet for a man who presented himself as a dilettante, his achievements, and his labours, were enormous. His correspondence runs to 48 volumes and that is only a fraction of what he wrote. And his literary output was only an aspect of his legacy.

The novel that grew out of Walpole’s dream was, The Castle of Otranto – first published on Christmas Eve 1764 and generally regarded as the original of all so-called “gothic” fiction. The tales of mystery and imagination by Edgar Allen Poe were descended from Walpole’s bizarre fantasy. So, too, in the 21st century, is an entire genre of writing and film.

The Castle of Otranto may be a little creaky, but it is still readable, containing a Harry Potter-like array of animated portraits, supernatural adventures in vaults and cellars and astonishing, inexplicable events. At the very beginning a Prince is crushed under a helmet, falling from the heavens, that is so large that its plumes appear waving at a first-floor window. It is – like all its gothic successors – a dip in the dark underworld of the subconscious. One can’t help suspecting that the sinister, unscrupulous, adulterous Count Manfred – the villain – owes a lot to the late Sir Robert Walpole, and his noble, mistreated wife to Lady Walpole, to whom Horace was intensely devoted.

Walpole said as much himself, several times. Strawberry Hill was “the scene that inspired The Castle of Otranto”. In fact, Walpole was scarcely embroidering reality in his dream at all. He had only to walk out of his bedroom to find a crepuscular staircase, like what you could see in an ancient ghost-haunted castle (or Harry Potter’s Hogwarts) filled with medieval military bric a brac, with suits of mail, broadswords and shields.

The only invented element in his vision was the “gigantic” size of the hand. His house – though much more architecturally distinguished – was in some ways a theatre or cinema set for a gothic horror movie. In the world of real buildings it was not the first building of the “gothic revival” – because the gothic style never truly died in the 17th and 18th centuries – but it was the first modern building based on a detailed observation of earlier architecture. That staircase, for instance, was partly based on one in Rouen Cathedral.

Walpole’s cosy villa was filled with fireplaces based on medieval tombs – one derived from the Shrine of St Edward the Confessor in Westminster Abbey, for example, “improved” by the architect Robert Adam. There was a ceiling based on a rose window in old St Pauls, a grand reception room derived from the funeral chapel of Henry VII. Considered as a place to live it was mind-bogglingly odd and original.

Strawberry Hill was in effect an architectural collage – devised by Walpole, the friends of his “Strawberry committee”, with help from professional architects such as Adam. Its object was to create atmosphere, what Walpole called “gloomth”, an emotional and evocative approach to building opposite to rationality of the classical Palladianism that was prevalent in Britain at the time. The house was the container for Walpole’s collection – an array of some 4,000 objects ranging from the beautiful and precious to the whimsical and spurious.

On display were paintings by Holbein, Reynolds and Watteau, historical curiosities such as Cardinal Wolsey’s hat and whimsical items such as the Chinese goldfish bowl in which poor Selima the cat had drowned. This was displayed on a gothic pedestal like a medieval font.

Strawberry Hill became, as Michael Snodin of the V&A, a Walpole expert, puts it, one of “most famous buildings of the 18th century”. The exhibition, and the restoration of the house, which opens to the public in the autumn, may well revive Walpole’s fame. Admittedly, he was eccentric – but his eccentricity was actually in the grand tradition of British imaginative quirkiness.