Agree with jerryh99 - immigration is a mess. I've also waited over an hour on bags in DMK - which is about the same as the flight time from Chiang Mai...
Another big assumption is that your inbound flight is on time... Hope for the best, but plan for the worst - I'd book the 3 hour connection and try and get on an earlier flight if things pan out better than expected.