Before we understood about microbes and their relationship to tooth enamel, we imagined that the painful holes in people's teeth were caused by burrowing toothworms (previously), something we confirmed by yanking out the especially sore teeth and observing the fiber-like "worms" (that is, raw nerves) that were left behind.
The image above shows a 4" high, 18th century ivory sculpture called "The Tooth Worm as Hell's Demon."
Treatment of tooth worms varied depending on the severity of the patient's pain. Often, practitioners would try to 'smoke' the worm out by heating a mixture of beeswax and henbane seed on a piece of iron and directing the fumes into the cavity with a funnel. Afterwards, the hole was filled with powered henbane seed and gum mastic. This may have provided temporary relief given the fact that henbane is a mild narcotic. Many times, though, the achy tooth had to be removed altogether. Some tooth-pullers mistook nerves for tooth worms, and extracted both the tooth and the nerve in what was certainly an extremely painful procedure in a period before anaesthetics. 
The tooth worm came under attack in the 18th century when Pierre Fauchard—known today as the father of modern dentistry—posited that tooth decay was linked to sugar consumption and not little creatures burrowing inside the tooth. In the 1890s, W.D. Miller took this idea a step further, and discovered through a series of experiments that bacteria living inside the mouth produced acids that dissolved tooth enamel when in the presence of fermentable carbohydrates.
Despite these discoveries, many people continued to believe in the existence of tooth worms even into the 20th century.
The Battle of the Tooth Worm [Dr Lindsey Fitzharris/The Chirugeon's Apprentice]