"..last night it all of a sudden formatted itself!"
Do you mean you actually saw it running the format program?
Or just that now you can't see the drive at all?
Sounds like it's faulty to me, if you can't get Windows to even setup on it, and it can't be seen as a slave in a working system.
When you set it up as a slave - can you look in Disk Management and see if it's shown there?