Thank you is defined as an expression of gratitude used to show appreciation for something.(interjection)
When someone does you a favor and you want to express your gratitude for what they have done, this is an example of a time when you would say thank you.
The definition of a thank you is an act or expression of gratitude.(noun)
When you are grateful to someone for doing you a favor and you bake him a pie to show your appreciation, the pie is an example of a thank you.
See thank you in Webster's New World College Dictionary
See thank you in American Heritage Dictionary 4
Learn more about thank you