The OS 40 FX is my favorite engine. I'm very much afraid you have ruined yours. Let's go through your symptoms and their causes.
The engine is running very hot, because it isn't being cooled properly. Cooling comes from two sources: the lubricant in the fuel and the air flow over the engine. Let's discuss the lubricant first. If the engine is run at a very lean setting, then it will get very hot, since it isn't getting enough lubricant. The lubricant helps carry away heat plus it reduces friction. The cure for the second problem is obvious.
I suspect the fuel and/or the needle valve setting is your problem. The first thing I would do is get some fresh fuel. Make sure that it's at least 18% lubricant. In general, some castor oil content is a good idea to protect your engine against lean runs, but you don't need 20%. BTW, the black exhaust is the Castor Oil getting cooked!
Next take out the needle valve and make sure there isn't any blockage. Also make sure nothing is blocking the fuel lines. Any fuel restriction will cause leaness. Next replace the NV and back it out 1.5 turns from a seated position and start the engine. Let it idle and examine the exhaust. Run the engine up a few times and note the exhaust. It should have a thick cloudy mist which is a sign of being overly rich.
Now turn the NV in two clicks and run the engine up. Each time detect the change in RPM. We aren't striving for the optimum NV setting but just a point where the engine runs well enough you can fly. Now fly the plane and see how it performs. If the engine is still too hot, you're going to need a rebuild. The black exhaust should have disappeared with a lower Castor content.
If everything is OK, you can tune the engine. Continue leaning it out until it just stumbles and then back the NV out five clicks.
Regarding a rebuild, OS parts are fairly expensive, and I believe that you'll be better off getting a new engine. With the new one, thoroughly read the manual and follow the break in instructions - no flying out of the box!
Ciao,
Mr Akimoto