The way that I would expect this to work is that you compute total Thai taxes due on your gross income, you are then allowed to deduct from that total any taxes already suffered, leaving a net amount payable in Thailand. Please note that if the taxes paid elsewhere exceed the Thai taxes then no refund is due!