phrase attested by c.1400, short for I thank you; as a noun, from 1792.
Old English þancian "to give thanks," from Proto-Germanic *thankojan (cf. Old Saxon thancon, Old Norse þakka, Danish takke, Old Frisian thankia, Middle Dutch, German danken "to thank"), from *thankoz "thought, gratitude," from PIE root *tong- "to think, feel." For sense evolution, cf. related Old English noun þanc, þonc, originally "thought," but by c.1000 "good thoughts, gratitude." The whole group is from the same root as think (q.v.). In ironical use, "to blame," from 1550s. To thank (someone) for nothing is recorded from 1703. Related: Thanked; thanking.