How about this design of analog comparator?
I took the time to plug your circuit into the LT-Spice Circuit Simulator and added a reference of 2.5V to the base of Q2.

Using a slow ramp pulse input voltage the circuit seems to work as intended.

This circuit will work as long as you can live with some specific details:

Over the operating range of 0V to 5V on the input expect that it will load the input driving circuit up to 120uA.
This circuit draws up to about 2mA from the 5V supply with about 1.14mA of that going to power the reference that I added. This is also with no additional load on the output except for the R7 10K resistor.
Do not expect very fast response time with this circuit. With no additional load the output rise time is on the order of 7usec and the fall time is even longer at about 20usec.
This circuit will not work for comparing voltages much below about 1.2V (i.e. setting a reference lower than 1.2V) due to the Vbe junction drops in Q1 and Q2.

If you want an improved circuit you would do better in almost every way possible by choosing a modern integrated circuit low power voltage comparator that is designed for 5V operation. There are many many part numbers to choose from.