Both words come from the same old Proto-Germanic root thankō, which meant something like thought, feeling, or gratitude. In other words, a thousand years ago, if you thanked someone you were literally thinking well of them. Gratitude was basically good thinking. Somewhere along the way we split the family. Thinking became something you do with ...
Think Before You Thank (Or Maybe Thank Before You Think?)

