If you post code you should use the [code=cpp]// Your code[/code] tag.
The problem is that you're creating a new thread object inside the if-block and since the thread object waits for the thread to finish executing at destruction and leaving the if-block destroys the newly defined thread object, the if-block is never finished. Besides that you might get some naming conflict since you use "spammer" for two different variables.
Additionally your code will never exit since your outer loop has no way to stop.
And calling terminate() is really bad. It's there for emergencies, but otherwise you should always let the thread finish on its own. Terminate will just "kill" the thread and leaving variables and other stuff in a uncertain state.
As for the code, you could simply use
sf::Keyboard::isKeyPressed(sf::Keyboard::Space) instead of the OS specific code.
Also if you actually intend to do some thread development, you should get yourself a book on that topic, because it's not trivial at all. There's a lot that one has to learn and that won't come natural to you. Things like: What are race conditions? When is something thread-safe? How do you synchronize shared data? What are lock-free containers? etc. etc. If you don't have a specific reason to do parallel programming, it's usually not worth investigating too much.
As a last suggestion, use
std::thread if your compiler supports C++11.