Oh cr*p
Reading your OP a couple of times it wasn't the site being hacked but your server,which means that was not secured somehow.
Was this shared hosting or a VPS and what control panel did you use?
I had a VPS messed with a couple of years ago and that was through CPanel.
I was lucky to have full backups and database copies so we were in control again within an hour.
The VPS was then firewalled so that only a couple of IP's could access it.