Also, pay attention that 180 days is for Thailand. For example for Poland you can be 10 days, but if you have a company or a family there you still can be a Polish tax resident. So read carefully your local law and the dta
If your country has DTA then you don't pay twice - that's what DTA is for. I believe even if you have no DTA but your country is from OECD you have some 'default dta' created by OECD. But if you're from another country... Yes, then probably you should pay twice.