You used to be able to buy the whole pack of tickets up till a week before the derby for like $20 less than full retail. But now with it starting 3 or 4 days before the "real weekend racing" it wouldn't really be beneficial unless you were going to be there EVERY day. I have been to the derby more than 10 years and have never had a problem buying tickets right at the gate on the day of any particular racing. In fact, I don't think there would be any reason the Deckers would cease ticket sales on any given day. It's not like the derby track has a maximum capacity like a restaurant.
Here is the derby link below, they keep it more updated during the winter but you can usually pull info off of it all year long. They also have phone numbers listed if you wanted to call and find out about tickets for sure.
http://www.derbytrack.com/
Oh, and X2 on the lodging suggestions.