Make sure you have a beer just before putting that balljoint back together.
You need to be relaxed and thinking clearly.
Clean the threads of the shaft and nut. Apply a LIGHT oil (wd-40 is good) to both. Keep them clean. The shaft is tapered so it can wedge into the hole when you reassemble. I usually put the shaft into the hole suddenly or have a helper step on the arm suddenly so the shaft bites and then hold it. Then put the castle nut on very gently. The clean parts with light lube will help. Don't start cranking on the castle nut until you've made sure that the shaft has bitten into the hole in the hub REAL good. If it starts to spin the shaft, start cussing, since it can be a real PITA at that point.
Take your time and take a deep breath.