The thread in codeblocks forum you linked is more than one and a half years old, back then TDM 4.7.1 may have not supported std::thread, but 4.8.1 does:
http://tdm-gcc.tdragon.net/ . That also suggests you are still using outdated codeblocks 12.11, when the newer 13.12 is better and can be got with an included TDM 4.8.1.
You should not use the compiler menu for setting build options, because that setting is only for that computer and will be forgotten if you copy your project to another. Open your project instead and rightclick on it and choose build options, to get a similar menu that works for saving the options in the project file, but dont forget to set it for both Debug and Release.
Also they do not add all GCC options to the code::blocks menu and when you have an old version you may need to set the older -std=c++0x instead of -std=c++11 (or type it into Other Options yourself).
Btw., there is an option in the compiler menu/Other Settings to show the full command line, activate it and see for yourself what gets passed to g++!