This information was taken from an article Heidi Anne Heiner (of Surlalune) wrote for Faerie Magazine.
The earliest known manuscript of "Goldilocks" was a little illustrated book done in 1831 by Eleanor Mure made for her nephew's birthday. The story was referenced in 1813 as well so we know it's been around since before then.
The older tales we know of centered around the bears, and the intruder was actually an old woman. The bears are the protagonists and the intruder the villain. Robert Southey's 1837 version of the story (which for years was thought to be an original story, before the Mure version was discovered) includes all male bears, whose voices were represented by different fonts. (This story makes a great music lesson plan for young children, as you can teach high and low sounds with the bear's voices).
Mure's tale has the bears attempting in vain to murder the old woman-their inability to do so probably because she was a witch.
The switch from evil old woman to adorable little gir began with Joseph Cundall in 1850, who, when explaining why he made the change, wrote that the tale was better known as "Silver-hair" (although the illustrations to his tale show a little brunette), and that there were already plenty of stories with old women.
The name "Goldilocks" was first used in 1904 and made popular when the version by Flora Annie Steel and illustrated by Arthur Rackham appeared with the now-famous name in 1918. Gradually the three bears became a family and narrators became more sympathetic with the little girl. Sometimes she was punished, but the name of the tale is revealing, because it used to be called "The Three Bears" and is now known simply by "Goldilocks." To some, the little bear is the real protagonist. The change of sympathy from bears to little girl reminds me of the reversible verses from Marilyn Singer's excellent book "Mirror, Mirror" (Buy it now. No, seriously):
ASLEEP IN CUB'S BED,
the headline read.
"They shouldn't have left
She ate the porridge.
They weren't there."
They weren't there.
ate the porridge.
"They shouldn't have left,"
the headline read:
ASLEEP IN CUB'S BED.
Heiner mentions a related tale from 1894 in which the trespasser is a fox or vixen-the term "vixen" could help explain the transition from fox to a woman.
Illustrations-Anne Anderson, Arthur Rackham, Jose Masse