I recently went from US to Costa Rica through Mexico City and was required to go through immigration in Mexico. This took over 2 hours and I barely made it on my other flight. Others in the line I overheard missed theirs. Not to mention it's painfully annoying!
Previously, I went from UK to Thailand through Delhi and didn't have to do this (only had to re-do security check).
Has anyone anywhere compiled a list of which airports make you do this? It seems to happen if you enter and stay within Schengen area (Going through migration at connecting flight airport) and I also found this thread from 2 years ago http://www.airliners.net/forum/viewtopic.php?t=1339401 Would be great to have an up to date list, so travellers could choose their flights accordingly.