You don't need 3 hrs for the palace, of all the attractions it was my least favorite. Bit boring I though.
I'd do the following
Blue Mosque - 1 hour
Hagia Sofia - 1 hour - 90 minutes
Eat a quick spot of lunch on the move - freshly cooked fish roll at the waterfront. These are lovely.
Short boat trip down the river and back - 90 mins - 2 hours
Grand Bazar/Spice Market - 2 hours. (Don't miss this its great).
You could swap the boat trip for the palace - personal choice really.
Istanbul done and dusted. What day you going? I think some of the sights maybe closed Sundays or Mondays - check this out before going.
Enjoy, its a great spot.