We have two versions of the Gospel of Thomas today. The first was discovered in the late 1800's among the Oxyrhynchus Papyri, and consists of fragments of a Greek version, which has been dated to c. 200. The second is a complete version, in Coptic, from Codex II of the Nag Hammadi finds. Thomas was probably first written in Greek (or possibly even Syriac or Aramaic) sometime between the mid 1st and 2nd centuries.
There has been much speculation on the relationship of Thomas to the canonical Gospels. Many Sayings in Thomas have parallels with the New Testament Sayings, especially those found in the synoptic Gospels. This leads many to believe that Thomas was also based on the so-called "Q" Document, along with Matthew, Luke, and Mark. Indeed, some have speculated that Thomas may in fact be "Q". Unlike the synoptic Gospels, and like "Q", the Gospel of Thomas has no narrative connecting the various Sayings. In form, it is simply a list of 114 Sayings, in no particular order. Comparison with New Testament parallels show that Thomas contains either more primitive versions of the Sayings, or developments of more primitive versions. Either way, Thomas seems to preserve earlier traditions about Jesus than the New Testament.
Although it is not possible to attribute the Gospel of Thomas to any particular sect, it is clearly Gnostic in nature. As the preamble indicates, these are "secret sayings", and are intended to be esoteric in nature. The Sayings are not intended to be interpreted literally, as their New Testament parallels often are, but to be interpreted symbolically, as attested by Saying #1. Thus in Saying #114, it is to be understood that "male" symbolizes the pneumatic (spiritual, or Gnostic) Christians, and "female" symbolizes the psychic (unenlightened, or orthodox) Christians, rather than actually referring to males and females.