IST has always had massive queues at immigration when I have passed through. We had a connection last year to a domestic flight which was tight and due to the massive lines it looked like no way we would make it.
Although at the main immigration line there is a sign that says domestic connections, there is another connection line near to one of the gates which had no-one in and we just about made it. This gate takes you direct into the domestic terminal and was the only reason we made the connection.
This is obviously for connecting from International to Domestic, not sure how this works the other way round.