1 Corinthians 14:17 (ESV)

17 For you may be giving thanks well enough, but the other person is not being built up.

There is nothing wrong with using the gift of tongues to thank God. In fact, it is something that Paul commends. The problem arises when this is done in public worship (without interpretation), because then the other person (the person who cannot understand the tongue) is not built up.