One of the earliest celebrity stalkers in recorded history lived in the walls of Buckingham Palace by day and stole Queen Victoria’s panties by night.

Around 5 a.m. the morning of December 14, 1838, a night porter glimpsed a a face in his window. It appeared to be smudged with soot, and belonged to a grinning, impish young man. Suddenly the face disappeared. After a brief search, the porter discovered one of the palace’s rooms had been ransacked. He sounded the alarm and a chase ensued.

A constable spotted the young man running across the lawn. He captured the intruder and brought him back to the kitchen, where the light was better. Not only was the boy’s face covered in grease, his clothes were slick with the substance. He wore two pairs of pants. When police stripped the outer layer off, several pairs of ladies’ undergarments fell out.

“Somehow…the boy had made it into the palace, strolling through the staterooms, corridors, and bedrooms like if they had belonged to him,” wrote Jan Bondeson in Queen Victoria’s Stalker: The Strange Story of the Boy Jones. He had entered the queen’s room and, along with her underwear, had stolen her portrait, a letter, and a collection of linens. Fortunately, the queen had been staying at Windsor Castle that night.

When pressed, the boy gave his name as Edward Cotton. The police learned he had hid behind the furniture or inside the chimneys during the day. At night, he strolled the halls and poked about. Sometimes during meetings between the queen and her ministers, he simply hid under a table and eavesdropped. When hungry, he helped himself to the kitchen; when he got too dirty, he rinsed his only shirt in the wash. He had been living in the palace this way for nearly a year.

And for years after, despite his arrests, he would return time and again to pester the palace and creep out Queen Victoria. The staff dubbed him “Boy Jones.”

Though not quite to the same extent, the nation was also enamored of Victoria. The previous two kings, her uncles, were corrupt, ineffectual, and old. Victoria was young and innocent, a clean slate for the nation. Her celebrity grew. Admirers threw letters into her carriage and visited the palace with marriage proposals.

In July of 1838, a silversmith named Thomas Flower was found sleeping in a chair close to the queen’s bedroom. One of her persistent admirers, he’d gained entry to the palace and, growing tired in his search for Victoria, fell asleep. He was sent to prison but two friends bailed him out for £50.

Palace bureaucracy made for laughable inefficiency. The tasks of managing such an operation were assigned to numerous divisions and offices. For instance, two different departments were responsible for cleaning the inside and outside of palace windows, respectively. Once, when the queen asked for a fire, an employee of the Lord Steward, who managed some of the house’s servants, replied that was impossible; he was responsible for building the fire, and another department was tasked with lighting it.

Security was equally sloppy. No one person headed up Buckingham security at the time. Palace police were organized by their territories, and the royal bodyguards made up the “A” division. (The unit was conspicuously absent the night Boy Jones broke in.) What’s more, the walls of the palace were low and looped with tree branches. Drunks, soldiers, and tramps were often found sleeping in the garden behind the walls.

As for Edward Cotton, on December 19 he appeared before the magistrates. The police office was packed with journalists. A witness identified the young man as his former errand-boy, who went by the name Edward Jones. His estranged father backed up the ID. When the magistrates questioned the spy’s motivations, Jones replied he had found all the stolen items on the lawn.

“I am going to send you to trial,” promised the magistrate.

“Oh, very well, with all my heart,” replied the boy, with composure.

In the end, after a trial filled with laughter and incredulity, the jury returned a verdict of not guilty. The police sergeant actually turned and congratulated Jones. The fact that he had managed to live undetected for so long indicated superior talents and intelligence. He just hoped Jones directed them to something worthwhile.

“Thank you, sir,” replied the Boy Jones before leaving court.

Still from “The Mudlark” (1950), starring Irene Dunne as Queen Victoria and Andrew Ray as Boy Jones. (20th Century Fox)

Not two years later, Jones climbed the palace walls once again. It was two weeks after Queen Victoria had given birth to her first child, with Prince Albert. That December 3, 1840, the queen’s governess discovered the Boy Jones under the sofa in the room adjacent to the queen’s boudoir.

“Supposing he had come into the Bedroom, how frightened I should have been!” wrote Victoria in her journal.

Jones was again arrested and tried. His insanity plea was thrown out, and he was sentenced to three months probation. After his release in March, he attempted to gain entry to the palace again, and got three months of hard labor for his trouble.

At this point, the courts didn’t know what to do with him. The crime wasn’t a felony, so they couldn’t lock him in British prison. They tried to convince him to join the navy. He wouldn’t. “Edward Jones was a very weird character and, apart from Queen Victoria, he was never interested in women,” author Jan Bondeson told BBC. “He was a very solitary character but he was not schizophrenic or classed as mad, just odd.”

After his latest release, when Jones was caught loitering near the palace once more, the government shipped the young man to Brazil. He was kept on a prison ship offshore for six years. During this time, he became an alcoholic and later a burglar, and managed to return to Britain. He was deported to Australia once more, where he sold pies before managing to sneak back to London again. Finally, he returned to Australia and worked as the town crier in Perth.

In the 1880s, in an attempt to escape his notoriety, the ex-con took up the name Thomas Jones. “He was very annoyed about always being known for being the queen’s stalker and felt persecuted by the jokes, even in Australia,” said Bondeson.

Jones died in 1893 after falling off a bridge while drunk. By then, Queen Victoria had added more palace guards.