there should be plenty of time to see both Hagia Sophia, and the basilica cistern in that time. Like Deniah said, take the metro from the airport to the city (Yenikapı) and walk through the grand bazaar to Hagia Sophia. The basilica cistern is right across the street from Hagia Sophia.
Happy touristing!