MARY SUE (n.):
1. A variety of story, first identified in the fan fiction community, but quickly recognized as occurring elsewhere, in which normal story values are grossly subordinated to inadequately transformed personal wish-fulfillment fantasies, often involving heroic or romantic interactions with the cast of characters of some popular entertainment.
2. A distinctive type of character appearing in these stories who represents an idealized version of the author.
3. A cluster of tendencies and characteristics commonly found in Mary Sue-type stories.
4. A body of literary theory, originally generated by the fanfic community, which has since spread to other fields (f.i., professional SF publishing) because it’s so darn useful. The act of committing Mary Sue-ism is sometimes referred to as “self-insertion.”
Making Light’s lengthy article on the concept of “The Mary Sue” is well worth reading.