The Gospel of Thomas is part of a collection of books found at a was discovered at Nag Hammadi in 1945. The books are 4th-century copies of Gnostic works written between 150 and 300. It is particularly important because it may be a form of a very early work about Jesus.

The most popular theory of Biblical origins holds that Luke and Matthew combined the Gospel of Mark and a second source, now lost (this second source is called Q). Q would have been a collection of the sayings of Jesus, probably without any connecting plot or history.

As you can see, many of the sayings in the Gospel of Thomas match--or nearly match--sayings in Luke and Matthew. It seems likely that Thomas represents a third witness to the lost Q source.

Thus, when Thomas differs from Luke and Matthew, it raises the tantalizing possibility that Thomas is a better representative of the original than the canonical gospels. However, Thomas shows strong Gnostic influence and dates about 100 years later than Luke and Matthew, so it's difficult to argue that Thomas is generally more accurate. However, there is at least a decent chance that Thomas records some real words of Jesus that aren't recorded in any other source. As you might guess, Biblical scholars love to argue about these issues...