How does 4 threads outperform 8?
Temps and ability to OC varies from sample to sample. you cant really say 38C is cooler than 40C (within margin of error) and if you topped out at 40C under heavy load with either sample you hit better than gold, like triple platinum! I can even do that with a custom loop and delidded CPU! It will idle and light load under 30C all day but as soon as I put a heavy load on its up to 60C and again, thats delidded.
The results of masses of others disagree with your results.
http://cpu.userbenchmark.com/Compare/Intel-Core-i7-7700K-vs-Intel-Core-i5-7600K/3647vs3885
“Two things are infinite: the universe and human stupidity, I'm not sure about the former” ~ Albert Einstein