You've got plenty of time, and I have to say Istanbul is one of my favourite cities. I'm taking a few trips to Europe soon, and am going to book Turkish Airlines just so I can stop over. We've loved it whenever we've visited.
Sultanahmet should take 45-50 mins, but if you go somewhere like Beyoğlu (near the Galata Tower) it's more like 30-40 mins.
I wouldn't be trying to go anywhere outside Istanbul on a short trip. Just have a wander, visit the usual stops (Ayasofya, Sultanahmet Mosque etc) and enjoy the food. You can take a ferry trip as well if you want to sir down for a while.
What are your timings? With 23 hrs, it's worth booking a hotel.