"Thag" is a hapless, mostly clueless caveman created by the cartoonist Gary Larson in his "The Far Side" comics.
Two of the most well known Thag cartoons are "Biiiiig one, Thag!", where Thag is accidentally knocked into the pit that they have just caught a large carnivore within, and by reference in a lecture given by one caveman to other cavemen warning them of the thagomizer
that Stegosaurs (and related dinosaurs) use to defend themselves from attacks - the four spikes at the end of their tails. Such was the humorous impact of that cartoon that the term thagomizer
is now an accepted term in scientific circles (look up "thagomizer" in the Urban Dictionary or Wikipedia)
Gary Larson wrote the "The Far Side" for 15 years ending in 1995; but his comics can be found in innumerable places (simply Google "Far Side" and you'll see many of Gary Larson's works as well as others that derive from his work. Books of his cartoons are still readily available from various sources (e.g. search for "The Far Side" on Amazon or other sources).
Often used to indicate a common foolishness among the conversationalists, such as "We might have drunk too much, Thag", and "Maybe we should have locked our car, Thag".
Also used when you are in the midst of landing something big, such as a big job ("Biiiig one, Thag") or a fish (same reference), and have some concern that it might be just TOO big. For example, in the movie "Jaws", the sheriff might have said "We're gonna need a bigger boat
, Thag!" if "Jaws" had not preceded "The Far Side" by some years. Similarly, when sorely trounced, one can utter "I got thagomized" or "he got thagomized".