Ahh. Multi-threading joy.

A tip for those people lucky enough to be using an AMD 64-bit X2 dual-core processor and use the high-frequency performance counter for game timing. Place a call to SetThreadAffinity() near the start of your game code to make sure the main thread always runs on the same CPU. The values returned by QueryPerformanceCounter() can differ depending on which CPU the thread is running on when it calls QueryPerformanceCounter(). This can make the game timing jump all over the place, even backwards. If the thread affinity is set to 1, then the thread always runs on the one CPU and the results returned by QueryPerformanceCounter() are what you would normally expect.