Permits for the Inca Trail that see you arrive at the Machu Picchu ruins are indeed limited, but I'm quite sure that if you want to trek to Aguas Calientes, you should not have a problem finding an operator at any time.
Cusco is full of operators that will happily accommodate you.
You have no choice but to buy tickets in advance for Machu Picchu itself. You can buy tickets in Cusco, at several outlets, or online, at http://www.machupicchu.gob.pe/.
If there are no tickets available online for your chosen date, you will have to use some extremely good social engineering skills to get into Machu Picchu: Tickets are valid for a particular day (and if you're going up Huaynapicchu a specific time) and are matched with your ID, which you have to provide when buying your ticket, and is checked upon entering the site.
It's easier to get train tickets to Aguas Calientes. However, booking your train ticket last minute can significantly increase the cost, particularly in the high season, which is now.