Actually, there's a story about that!
Mary Sue is a title that originated in the late 1970's, in the Star Trek fandom. A woman named Paula Smith created a fictional character named "Mary Sue" that was given all the traits of a mary sue in a satirical fashion. She wrote a fan fiction and submitted it to a magazine. Menagerie's editors, in 1976, said that
"Mary Sue stories—the adventures of the youngest and smartest ever person to graduate from the academy and ever get a commission at such a tender age. Usually characterized by unprecedented skill in everything from art to zoology, including karate and arm-wrestling. This character can also be found burrowing her way into the good graces/heart/mind of one of the Big Three [Kirk, Spock, and McCoy], if not all three at once. She saves the day by her wit and ability, and, if we are lucky, has the good grace to die at the end, being grieved by the entire ship."
It has since spread, both in popularity and meaning