It often happens through either an insecure install or out of date install of a popular script, such as wordpress, or the server is compromised - either through another account being 'hacked' or through someone registering as a legitimate user and exploiting it.
I've done it before when I was a little miscreant doing everything to annoy people, I found a bug within cPanel and used some prebuilt script to exploit it and access all user accounts on the server, I was able to take over quite a few websites. The best thing you can do is request that dreamhost move you to a new server within their network, the current server is most likely fully compromised and reupload won't do anything.