Try this. Power off the computer. Disconnect the drive's IDE cable. Restart the computer and boot into Safe Mode. Look in your device manager under CD-Rom drives or whatever it lists for you that has to do with optical drives. Delete any entries that may be there, and reboot into normal mode windows. Let it load, and then power down again. This time, change the master/slave setting on the drive itself, for example, if the drive was a master on the secondary chain, try putting it into slave on the secondary chain, and restart the computer. Go DIRECTLY into your BIOS and make sure the drive is where you put it at. Once you've verified that you have the drive in a different place, boot into normal windows and let it re-detect your drive. This will kinda force windows to re-install the files needed for the device. If it still ejects randomly, look for a firmware upgrade. If it STILL doesnt work, try another drive. If another drive does it, then it's definetly something you've installed, or contracted from the interweb that's causing the random ejects.
Sure, it sounds like it's a lot of trouble, but you have to be thorough. Don't Assume Anything. One of the many unwritten rules any computer tech should know and obey.