The first Mary Sues were fanfic characters introduced into the world of the main characters, who were gradually revealed to be smarter, prettier/handsomer, braver, more competent, sexier, and basically all around better than any of the main characters, and wound up saving the day/ship/planet/universe. The regular characters became mere pawns in a story all about
her, who was generally perceived by readers as a surrogate for the author (usually female). The Mary Sues were often a teenage girl in a world of adults. Wesley Crusher is sometimes described as the first canon Mary Sue regular cast member.
If you haven't yet taken
King Daniel's advice,
http://en.wikipedia.org/wiki/Mary_Sue