it expires when your re-entry permit expires as you must've had a single entry visa. Therefore the re-entry permit allowed you to leave whilst keeping your student visa valid. Failure to return by the expiry date on your re-entry permit will automatically result in your student visa being cancelled.
Whatever visa/extension of stay you're currently on will become invalid if you don't return by the 26th. If you're on an extension of stay based on employment then you need to speak to your employer as your right to work in Thailand will be revoked if you don't return by that date.
To solve the flight issue book your Turkey flight for whenever you're planning to use it.
Then either buy a cheap throw away ticket to SG or Phnom Penh (wherever is cheap basically) to show you're leaving Thailand before your tourist visa or visa exemption expires or buy an onward ticket from a website which deals with them. I haven't used any but others have, Google will have plenty of suggestions for this part.