There isn't an ending -ht in English; rather, your first set of examples use the ending -t. The <gh> comes from the stem; in several of your examples this isn't obvious because related words (dry, sly, see) are no longer spelled with <gh>, but since the <gh> is silent in Modern English, perhaps that shouldn't surprise us. (In the case of thought, the related word think never had <gh>; rather, the <gh> of thought corresponds to the /k/ of think.)
As for -th vs. -t . . . you're probably aware that there are a few endings that are always -th (e.g. the ordinal ending as in eighth) and a few endings that are always -t (e.g. the past-tense ending as in slept), but for the ending that you're interested in, the alternation between -th and -t has to do with the sound that preceded it in Old English or Middle English; -th was the usual form, but -t was used after fricatives, including the /h/ sound that eventually disappeared from pronunciation but left us with the written <gh>. (Some non-/h/ examples are theft and thrift.)
Sources: