Martin Hall, genial, white-coated head of research at the Natural History Museum's Department of Entomology, holds a miniature glass phial up to the harsh fluorescent light of his gleaming laboratory. Inside, a handful of small brown bugs bob lifelessly in clear preserving fluid.

"So here," says Hall, with suitable drama, "they are: the Ruxton Maggots."

Were it not for the maggots, it is pretty safe to say the case of Dr Buck Ruxton, one of Britain's most celebrated prewar murders, would be all but forgotten. On 13 March 1936, the Bombay-born GP, admired and appreciated by all in his Lancaster practice, was sensationally found guilty of killing his common-law wife, Isabella Kerr, and their maidservant, Mary Jane Rogerson.

Ruxton, born Buktyar Rustomji, had somehow become convinced that his extrovert companion was having an affair (no evidence was ever found that she was). In a fit of jealous rage, he leapt on her and strangled her with his bare hands. The unfortunate maid he suffocated immediately afterwards to prevent her revealing the crime.

Putting his professional knowledge to effective use, the good doctor then mutilated the corpses, removing identifying marks such as moles and scars, dismembered them, and wrapped the 70-plus body parts in old copies of the Daily Herald, Sunday Graphic and Sunday Chronicle. He loaded his gruesome cargo into his car, and dumped it in a remote ravine more than 100 miles away, on the Scottish Borders.

Two key errors led to Ruxton's arrest: one of the papers he used turned out to be a special edition, sold only in Lancaster and Morecambe; and, on the way home, he knocked a man off his bicycle in Kendal and the police noted his licence plate.

But crucially, the case against the doctor was also much aided by a certain Dr AG Mearns, an expert on insects, who established the date on which the body parts had been deposited in the ravine from the presence of a mass of bluebottle larvae, aged 12 to 14 days, crawling all over them. That corroborated other evidence in the case, helping to ensure Ruxton's conviction and eventual hanging.

It was the first time a maggot had been used in a court of law to convict a criminal. These days, of course, thanks to TV series such as CSI: Crime Scene Investigation and Bones, and movies such as Silence of the Lambs (in which a seriously deranged serial killer memorably places the pupa of a death's-head hawkmoth in the mouth of his victims), the forensic entomologist – a scientist who specialises in studying the insect life on and around a cadaver to ascertain time (and sometimes place) of death – is a rather more familiar figure.

Courteous, quick and disarmingly normal, Hall, one of the museum's 300-plus behind-the-scenes scientists who will be showcasing their work at an open evening tomorrow, is nothing like the obsessive, borderline nut-jobs TV apparently thinks bug experts should be. (That said, he is not above the odd unnerving observation. "It's a strange smell, isn't it," he muses, as we enter the malodorous confines of his culture research room, where a host of assorted maggots feast on rotting liver and dog food. "Quite sweet, in a way.")

But undeniably, he devotes at least some of his time to doing exactly what the guys on the telly do: last weekend, for example, he spent 12 hours on a crime scene in the Midlands. "They'd found a body, a woman. It looked like she'd probably been there for some time. It was quite . . . gooey. Quite a gungey body." Fortunately, perhaps, he is forbidden from disclosing much more: like several of his 50-plus entomologist colleagues at the museum, Hall gets called out to crime scenes by police forces from around the country, but cannot discuss individual cases except in the most general terms.

These flies can detect death from 10 miles away

The principles of forensic entomology, however, are another matter, and they are the same whatever the case. A great many species of fly feed, in their larval or maggot form, on what Hall delicately calls "carrion". The ones that interest him most, because they are capable of detecting death from as far as 10 miles away and are therefore often the first to find a dead body, are those of the family Calliphoridae, better known as blowflies. In Britain, they include the common bluebottle and greenbottle, and they are the forensic entomologist's raw material.

Underlying the science is the helpful fact that flies go through four main and identifiable developmental stages, from egg (which will generally hatch within 24 hours) to larva (which will feed on the corpse for about five days, then spend another couple preparing to pupate) to pupa (equivalent to a butterfly's chrysalis; another seven days) and onwards to adult fly. The maggot stage, in particular, can be further subdivided into three distinct phases, known as instars.

The exact rate at which a fly develops through these stages can vary significantly according to a number of factors, notably the temperature at the scene, the size of the body, whether it is in the open air or in a sealed room, and whether it is naked or clothed. The forensic entomologist's basic job, then, is to collect and measure the insect life on and around a dead body, factor in all the variables, and come up with an approximate time for when the first flies arrived on the scene. "After about three days, it becomes hard for an ordinary pathologist to judge the time of death," says Hall. "Insects can be more accurate. Within limits, in the first week or so of development, you can be accurate to within a day. They're also good even if a body has been burned, for example, which makes things very hard for a pathologist."

A small plastic spoon is perfect for scooping up maggots

Forensic entomologists provide what is called a minimum postmortem interval, or PMI. "What we can do is say when the insects found the body," Hall says. "In summer, in the open air, that can often be within an hour of death. In winter, or indoors, it can take much longer." But knowing when the flies arrived can, in itself, prove a critical piece in the evidential puzzle that will solve a murder. So can the kind of flies found on the body.

"If a body is found in a rural location, somewhere where you'd normally expect to find all sorts of blowflies, but those we find on it are only of one sort, say a more urban variety, that could be a strong indication that the body came there from somewhere else," says Hall.

Hall's scene-of-crime kit includes a collapsible net to capture adult flies, a magnifying glass, a digital thermometer, a small cube of high technology called a data logger (it checks and records the temperature at the scene every hour), and a small plastic airline coffee spoon that's "brilliant for scooping up maggots". Some specimens are killed at the scene by plunging them briefly in boiling water, then preserved in ethanol for future analysis. Others are captured live, taken to the culture room, placed in incubators at the right temperature, and fed.

"The live ones give you a second handle on ageing," Hall says. "If I know it takes 20 days for these type of larvae to become flies in these particular conditions, and they become flies after 10, I know they were 10 days old when I got them."

The foundations for forensic entomology were laid by a Frenchman, Jean-Pierre Mégnin, in two pioneering late 19th-century works called Fauna of the Tombs and Fauna of the Cadavers; both are still on every forensic entomology student's reading list. The science is still developing, though, Hall says, and his culture room contains several incubators holding specimens destined solely for research (a current project is the low-temperature development of bluebottles; flies that take a fortnight to mature in summer may, apparently, need up to three months in winter).

"We know only a few species well," says Hall, who has been fascinated with insects since he was a small child. ("I grew up in Africa, where we had a mosquito net. It was supposed to be used to keep the insects out, but I used it to keep them in.") "There's a lot we need to learn about others, and about temperature ranges. There's plenty still to be done."

Things have come a long way, though, since Dr Mearns and the Ruxton maggots. In America they are working on the changing odour of decaying, insect-infested flesh as an indicator of PMI; Hall has begun experimenting with thermal imaging technology to measure the heat generated by a mass of maggots (the hotter they get, basically, the older they are).

CSI's failing is that it gives you no idea of the smell

Certain key cases have advanced the science's cause, leading to far greater acceptance among police and pathologists. The so-called Lydney Murder was one such: on 28 June 1964, police were called to a body in woods near Bracknell, Berkshire. Its dreadful condition led them to assume it had been there for at least four weeks, but Professor Keith Simpson, a pioneer of forensic entomology in this country, told them it was more like nine days, and certainly no more than 12. Missing persons records for that period pointed to a Lydney resident, Peter Thomas, who had gone missing at exactly that time, and fingerprints confirmed the identification.

A couple of Hall's cases stand out, he says. "One was in winter. A body was found wedged in the narrow space between a building and a steep embankment. The pathologist thought it had been there for maybe two to three weeks, but the insect activity was showing two to three months. In fact, it turned out to be a tragic accident: the chap had fallen down the embankment and broken his back. But at least it gave closure to his family; they could account for the gap between his disappearance and discovery, and they knew when he died."

Another particularly satisfying case was a suitcase murder: "The body was in a suitcase. We were able not only to give an approximate time of death, but to say when the case was dumped at the scene. We did that by comparing the age of the eggs on the outside of the case with the age of the youngest maggots inside, which would have been laid as eggs just before the body was zipped up inside the case. That was quite rewarding." In a third, the insect life on a badly burned and otherwise all-but-impossible-to-identify corpse found in an old second world war ammunition bunker allowed Hall to tell the police the body had been dead for seven to eight days, allowing them to focus their inquiries and, eventually, trace the victim.

Down a couple of floors from Hall and along the corridor, behind a locked door marked Paleontology, is Heather Bonney, who often gets to deal with bodies that have been dead a good while longer than that. "This one," she says, deftly hefting an almost fossilised skull and lower jaw, "died in about 7,000 BC. He's 9,000 years old." Every bit as cheery and matter-of-fact as Hall, she is the museum's forensic anthropologist, and when she is not working on its own collections she, too, is helping police with their inquiries.

Unlike Hall, who focuses mainly on the when, Bonney looks at the who. She will also be discussing her work tomorrow evening, though she is at even less liberty than Hall to discuss specific cases. "They're quite high- profile, usually," she says. "Lots of media interest. But it's usually about helping identify the deceased where the condition of the body makes that difficult – so burned, dismembered, decomposed, that kind of thing." Many of her call-outs turn out to be false alarms: bones that date back centuries (or not even bones; members of the public have been known to hand in any number of odd objects in the firm belief they are prehistoric body parts.) The others are real.

"Usually," Bonney says, "I'll go to the postmortem, or to the mortuary just afterwards. The ideal is to be at the scene of crime: the context the remains are found in is almost as important as the remains themselves, particularly if there's little or no tissue left. Also, if we're there, we'll be sure of recovering absolutely everything, down to the very smallest bones."

Forensic anthropology can establish first whether remains are human or animal. If they are human, it can estimate how long the body has been in situ (bone also decomposes, albeit less radically than flesh, although the rate can vary according to the dampness of the surroundings, the amount of oxygen present and the chemical make-up of the soil).

By looking specifically at parts of the skull (the ridges over the eyes, the area behind the ears) and pelvis, Bonney can determine whether the body is male or female. By examining the teeth and looking at the places on the body where bone joined cartilage, she can make a pretty reliable estimate of age. By taking precise measurements of the skull and feeding them into a computer database, she can establish ancestry (or ethnic origin), and by measuring the arm and leg bones and feeding the results into a mathematical formula, she can arrive at height. Sometimes her analyses will turn up evidence of previous disease or trauma that can provide further identifying information.

"If it's a missing person, forensic anthropology can help confirm a body could be the person the police think it is," she says. "If they have no idea who it is, it can help narrow the field, give them an idea where to start looking. It's not quite as exciting as TV makes out – we're a discrete part of an investigation. We don't go round interviewing suspects. We come in, do our work, submit our report, and usually the next we'll hear of a case is when it comes to court. But I love it. It's never boring; every case is different and you can never, ever go by appearances."

Meanwhile, a selection of very dead maggots have found themselves under the binocular microscope in Hall's lab. Their hard brown forms are projected on to a computer screen, and some nifty software allows Hall to drag a red line along their bodies and measure them to within a thousandth of a millimetre. "I know the species, and I know these maggots will have required a certain thermal input to attain that size," he says. "So now I'll use the figures from my data logger at the scene, and correlate those with the relevant Met Office data, and feed all that into a calculation, and I'll end up with a date for when these maggots were laid as eggs on the body they were found on. It's not as glamorous as CSI makes it look, certainly, but it's satisfying. Though CSI's one big failing is that it gives you no idea whatsoever of the smell."

• Visitors can meet members of the forensics team and other Natural History Museum researchers at After Hours: Science Uncovered, on Friday 24 September, from 4pm-10pm. The scientists will demonstrate aspects of their work and explore some of the museum's scientific treasures up close.