**Yes—you can buy a same-day Istanbul–Ankara YHT ticket at Pendik’s ticket office, provided seats are still available.** TCDD sells YHT tickets both online and at station counters. [Official transport FAQ](https://123.gov.tr/sss?lang=en)

The practical points are:

- **Seats:** Waiting means fewer seats and departure times to choose from. If your preferred train is full, you’ll need another departure; buying at the station does not guarantee a place.
- **Price:** YHT generally uses published fares rather than airline-style prices that rise as departure approaches. The main reason to book early is securing a seat. However, I couldn’t verify a current official guarantee that every equivalent online and counter fare is identical.
- **Changing an online ticket:** You must formally change the booking—you cannot simply use it on a different train. The replacement train must have availability. The latest rule update I could verify requires changes **at least 75 minutes before the booked departure** and applies a **10% deduction**, with any additional fare difference payable. That update dates from October 2023; TCDD’s current detailed rules page failed to load, so check the conditions displayed when purchasing. [Published rule update](https://www.trthaber.com/haber/ekonomi/tcdd-iade-islem-ve-bilet-degisiklik-surelerini-guncelledi-805067.html)

The government FAQ also lists a **flexible ticket (“Esnek”)**, costing 20% more and allowing three changes, versus one change for a standard ticket. It still requires a booking for a specific departure. Confirm that this option and those conditions appear at checkout. [Official ticket-type guidance](https://123.gov.tr/sss?lang=en)

**For your situation, I’d check availability online before travelling to Pendik and buy as soon as your timing becomes clear.** Waiting until the station is reasonable if you can accept a later train—or a different travel plan if the remaining services are full. Search specifically for **Pendik → Ankara**.