It depends. If you are tilting even a bit, then you are probably justified in quitting. Conversely, if you shake it off barely fazed because you know that variance balances out long-term...then the correct approach might be to stay if you are at a good table and perceive yourself to be one of the best players there.
Also, "how" did they both hit Quads? Was the Four of a Kind completely lucky (in which case, you might be more inclined to stay) or did they simply hit monster hands by chance and then play it really well (in which case, you might be more inclined to quit or move tables)?