Need a modified S-R latch
Try this:



R1 depends on the used logic family. In a noisy environment Schmit-trigger input and a capacitor can be useful.

It could be even simpler if you integrated the latching operation to the comparator (=a breakable feedback which forces the comparison result to LOW when it drops to LOW)