"God" is a proper noun, and for that reason should be capitalized. So the phrase "Thank God" is appropriate. There are so many contextual nuances that it is truly easier to adhere to that standard, unless you are trying to make a very explicit statement.
Even with that standard, you will not please everyone, but at least you are less likely to cause confusion. For example, Christian and Islamic faiths refer to "God" as "God". So do many Jews. However some religious Jews use the following "G_d" or "G-d" instead.
If one were writing for an audience with a pantheist belief system, I think it would still be correct to refer to God with a capital G, but maybe in the plural case. "Thank the Gods". Whether a single or multiple instance, you are referring to deities.
If you are worried about offending non-religious or atheist readers, do not use the expression "Thank God" at all. There are many alternatives.