First, only the person who writes thanks can tell you for sure why they did. So for the example added to your question you would have to ask user Faizan Mubasher why he said thanks.
However, I can give a couple possible meanings. We say thanks when other people do something for us. In the example added to you question, Faizan Mubasher could just be saying thanks for providing such a good question to answer or thanks for allowing me to answer your question or thanks for using Stack Overflow. Who knows?
In general, when communicating in English, a sincere thanks or thank you is always welcome. Except here on Stack Exchange. Since this site is meant to build up a library of unique Questions and Answers usable by anyone, personal touches such as thanks and hope this helps are judged by a high number of users to be extraneous. See
How helpful is it to add "Hope this is helpful!" to an ELL answer?
And while this might be true from one standpoint, it certainly makes SE seem an arid place to participate in sometimes, since the 1-on-1 connection between asker and answerer is discouraged or non-existent. While writing a good answer is deemed the best way to help the user, this ignores the human element. Other Question & Answer websites do not have such a policy.
Hope this is helpful!