Assuming your luggage is checked through to your final destination and that you have your boarding pass in hand, it's doable, but there's not much to suggest.
When you land, you still have to disembark, go through passport control and change money or make a withdrawal from an ATM. Without Turkish liras you won't be able to go anywhere. Then you can take the tram (with a change of trains - get exact instructions before you leave home) to the old city center and wander around. It's safe. It takes about an hour each way. The only place that you might still catch open is the Grand Bazaar - shops start to close up around 20.00 and by 21.00 expect it all to be shut down. Though these days, with few tourists, they may be closing even earlier. Landmark buildings like the Hagia Sofia and Blue Mosque will be floodlit and are not far from the Bazaar. You can grab some local food and drink too. When you get back to the airport, you'll go through security to get to the boarding area - that's where you want to spend the night.
The tour sounds like a hop-on, hop-off bus. You'll just see the sights from the bus window, except for what sounds like 3 stops - at the Bridge, the Cistern and you won't have time at the palace to do more than see some of the buildings from the outside. My estimate is that at least 1.5 hours will be used just driving to/from Ataturk. The traffic is not because of tourists, it's the millions of locals who live there. You could probably do better to take the tram again (they have the right of way on the streets) and choose one sight to visit in the morning on your own.