Turkish transit visa on arrival

I’m flying from London to Mumbai in May, and then back from Kathmandu to London later in the month. On both journeys I have a short (1-2 hours) stop over in Istanbul. If everything works, I know I don’t need a transit visa because there isn’t time to leave the transit lounge at the airport.

However I’m concerned what happens if I miss my connection. Obviously as I have a through ticket the airline will get me on a later flight and that won’t significantly inconvenience my later plans. But on my outwards journey I’m on the last flight to Mumbai of the day, so if I miss it, I’ll have to spend the night in Istanbul. If that happens, I’d rather pay for cheap hotel than try to sleep in the airport. Is it possible to apply for a transit visa on arrival in those circumstances?

Edit: I’m flying on a British passport, and there are no obvious reasons why I would be refused a visa.