Open a photograph album of Victorian London and you enter a strange twilight world. Clothes and objects are drained of colour, restricting life to a palette of bleached and muddy greys. And everywhere there is the same silence. The churning noise of the city is cancelled out by the click of the shutter. While modern historians might regret the loss of a soundtrack to the Victorian city, however, many residents of the time would not have agreed. For them the noise was unbearable. The low grumble of traffic, the sudden spikes of street music, the endless chattering crowds: it was little wonder that Thomas Carlyle retired to a soundproofed study.

The cries of street traders were especially penetrating. They had to be. In such a fiercely competitive environment, the jabbing emphasis of a cry such as "Water-creases!" was the aural equivalent of sharp elbows in a crowd. Like birdsong, what might have sounded charming at a distance was a way of advertising oneself and fighting off the competition. Nor were these traders content to stay in the shadows. In 1872, the writer Augustus Mayhew appeared before his local magistrates charged with assaulting a female pedlar, and defended himself by pointing out that sometimes "he had as many as 38 persons in one day" knocking at his door. Their cries of "Rag and bones", "Sixpence a peck, peas", "Crockery", "Fine young rabbits", and "Roots all a-blowing, all a-growing" had driven him to distraction. Presumably they thought he would be a soft touch. In the 1850s, he had assisted his brother Henry in conducting hundreds of interviews with "The London Street-Folk", which when published as London Labour and the London Poor had made their voices heard all over the country. With its dizzying tables of statistics and dazzling range of characters, it was both one of the most ambitious early attempts at sociology (a word coined in the 1840s) and the greatest Victorian novel never written. No work in the period is better at bringing alive what Mayhew's later magazine The Great World of London called "the riot, the struggle, and the scramble for a living".

London Labour and the London Poor was originally advertised as a "Cyclopoedia" of street life, implying that it was a compendium of facts for dipping into rather than a book to be read from cover to cover. In its final form, it was published in four volumes in 1861-2 – two million words – and there was scarcely a paragraph that did not contain startling information. The popularity of oysters in London meant that "in round numbers" there were 500 million shells to be disposed of every year. An old showman who travelled with performing animals "sometimes had trouble to get lodgings for the bear", even though "Bears is well-behaved enough if they ain't aggravated". While there were some strange omissions – Mayhew included nothing on servants, for example, who by the time of the 1851 census amounted to one in 18 of the population – for the most part he lived up to the billing he gave himself in the work's preface. Part-pioneer and part-anthropologist, he was a "traveller in the undiscovered country of the poor" who brought back stories about people "of whom the public has less knowledge than of the most distant tribes of the earth".

That was scarcely an exaggeration. Though many thousands of people earned their living in the streets by the middle of the century, in terms of cultural representation they were practically invisible. Their appearances in print were usually restricted to cartoons in Punch, which whittled away their lives to a set of comic catchphrases, or novels in which they provided little more than splashes of local colour, such as Dombey and Son's description of "the water-carts and the old-clothes men, and the people with geraniums, and the umbrella-mender, and the man who trilled the little bell of the Dutch clock as he went along". By contrast, Mayhew decided that what his interview subjects said would be the foundation of his work rather than a set of footnotes. The background was thrust into the foreground, and for many readers the effect was as astonishing as if pieces of theatre scenery had come to the front of the stage and introduced themselves to the audience.

London Labour and the London Poor would have been a remarkable achievement no matter who had written it. Coming from Mayhew it was close to being a miracle. Although reasonably well known as a writer before he started his research, he was spoken of by his contemporaries with an amused tolerance that bordered on contempt. Whether he was abandoning half-written works, or almost blowing up his house while trying to manufacture artificial diamonds, he was much better at coming up with ideas than seeing them through. From 1835 he edited the satirical journal Figaro in London; it collapsed in 1839. In 1841 he helped to found Punch, but was ousted as editor after a few months. He seemed doomed to be the nearly man of Victorian letters.

Then in September 1849 he was sent by the Morning Chronicle to report on a severe cholera outbreak in the Bermondsey slums. By October the Chronicle's editors had announced a new series of articles, aimed at providing "a full and detailed description of the moral, intellectual, material, and physical condition of the industrial poor throughout England", and Mayhew was to be the Metropolitan Correspondent, filing regular reports from areas of London that might as well have been on the moon for all the notice most people took of them. He set about interviewing the crossing-sweepers, Punch and Judy entertainers, sandwich-sellers, rag-gatherers, rat-killers, doll's-eye makers, thieves, prostitutes, beggars, and all the other pieces of human flotsam and jetsam that had washed up in the capital. However, it was only after he abandoned the Chronicle and started to publish his reports independently that the full scale of his ambition became clear.

The impact of his work was immediate. When it came to the saddest cases, he also raised money. Donations totalling £2 10s were forwarded to "the poor half-witted and very persecuted harp-player" whose handwritten sign explained that "from the delapedated [sic.] condition of my present instrument I only produce ridicule"; it was enough to buy him a new harp.

Mayhew's impact on writers lasted rather longer. Starting with Charles Kingsley's Alton Locke, which leaned heavily on his revelations about cheap tailors, his influence stretched as far as Philip Larkin's poem "Deceptions", which re-imagines his harrowing account of a young girl being drugged and raped, and a number of recent works, including Charles Palliser's The Quincunx and Michel Faber's The Crimson Petal and the White. What these writers recognise is that Mayhew was far more than a snooping reporter. He was also a skilled storyteller. Some of his techniques specifically echo other genres of writing. By tangling together biography and autobiography, for example, and removing his own questions from the printed version of his interviews, he came close to producing a prose version of the Victorian dramatic monologue. Far odder are the parallels between some of his subjects and Dickens's characters, as if he deliberately sought out people who had sprung off the page into real life. Yet Mayhew also had a style of his own, and it is this that makes London Labour and the London Poor something other than a documentary record. It is a creative reworking of the facts, a consistently surprising exercise in that hybrid form Joyce once described as "fict".

As Mayhew trawls the city streets, his attention is snagged by details – a walnut-seller's brown-stained fingers, or a beggar who displays himself in front of a shop's gas jets like an actor in the footlights – before they are lost again in the crowd. He is equally attracted by lists, such as the one recording the first items ever stolen by a group of young thieves: "Six rabbits, silk shawls from home, a pair of shoes, a Dutch cheese, a few shillings from home, a coat and trousers, a bullock's heart". These are not just stray objects, like the ones picked up by the bone-grubbers and mud-larks, but the props in a series of personal dramas.

Mayhew's statistics reveal much about his own obsessions. Sober tables of research are regularly interrupted by facts of the strange-but-true variety: "Total quantity of rain falling yearly in the metropolis, 10,686,132,230,400 cubic inches", or "The drainage of London is about equal in length to the diameter of the earth itself". Yet the further he goes to demonstrate painstaking accuracy, the more tempted he is to retreat into the consolations of romance. Not content with calculating the number of cigar-ends thrown away each week (30,000) and guessing at the proportion picked up by the cigar-end finders (a sixth), he continues by explaining how this "refuse tobacco" is made into new cigars; "or, in other words, they are worked up again to be again cast away, and again collected by the finders, and so on perhaps, till the millennium comes". It is a good example of what a contemporary reviewer meant by Mayhew's "wonderful series of revelations suddenly disclosed in our own country, existing as it were, under our very feet".

But while Mayhew was thrilled by statistics, he was more interested in the people behind his calculations and tables. Never was he happier than when distracting himself with the sort of quirky odds and ends that a more rigorous mind would have dismissed as insignificant, such as the people who "strengthen a sickly child's back" by rubbing it with snails, or the footman who considered enlisting in the army but "knew I should be rejected because I was getting bald".

Some of these characters are presented as timeless types. Mayhew's account of the cheap goods sold on street corners that carry "gaudy labels bearing sometimes the name of a well-known firm, but altered in spelling or otherwise" will be familiar to anyone who has been tempted to buy a "Louis Viton" handbag or "Guchi" watch, just as the swindler who poses as a "Decayed Gentleman" and sends out begging-letters will strike a chord with anyone stung by email spam. The vast majority of Mayhew's subjects are simply, magnificently themselves. Whenever his writing threatens to descend into the period's standard responses of disdain or whimsy, his ear catches the unique accent of an ordinary voice and elevates it to the dignity of print. There is the realism of the Italian showman who lost his monkey: "I did cry! – I cry because I have no money to go and buy anoder monkey!" Or the humour of the man who hawks fly-papers: "It ain't a purfession and it ain't a trade, I suppose it's a calling."

Open the pages of this extraordinary work, and once again the voices of Victorian London stir into life: "I ain't a child, and I shan't be a woman till I'm twenty, but I'm past eight, I am"; "Ain't it curious now, sir, that wot a man larns in his fingers he never forgets?" Once again the clamour of the streets rises into the air until, like the evening scene in Bleak House, "every noise is merged . . . into a distant ringing hum, as if the city were a vast glass, vibrating".