It uses a heuristic which selects which point of the existing four that should be replaced by the new point. This heuristic function produces a value that's proportional to an approximation of the contact surface area, i.e. two triangles that form the quadrilateral with the four contact points. It goes over each possibility, replacing one point at a time by the new point and finds which configuration maximizes contact area. And yes, it also prioritizes the deepest point. This helps prevent the deepest from being replaced which would result in visible penetration.
Another possible heuristic is to maximize the surface area of the tetrahedron formed by the four points, which is what I do in my physics engine and I get satisfying results. By consequence, this method chooses to keep the deepest point since it results in a bigger tetrahedron with larger surface area.