I would strongly caution against this. If there is another airplane full of people in front of you, the immigration hall can be quite full and it can take 1 hour to clear.
There is a door to the right (where you buy the visas) that says 'transfers,' but I don't know how it works. The door seems to open directly to the outside and there is a police guy there, bored at his desk. In five years of weekly Cairo trips, I *never* saw anyone use it.
On days Sat - Wed there are two daily flights into Cairo. You could land at 12:00noon and take the 19:00 departure out. There's a decent restaurant in the airport before check in. It's a long time, but no fear of missing the connection.