I've put together a python script to select only the vertex with the minimum z-coordinate from a vertex selection in a mesh. The problem is that it works randomly, resulting in the correct selection only about once in four attempts. Most of the attempts result in none of the vertices getting selected. I've tested it on a square grid of unconnected vertices with neighbour correlated random z-coordinates.
I'm using blender 3.4.1 on MacOS Ventura 13.1
Sample file is here
Tis is the script:
import bpy
# Enter Object Mode
bpy.ops.object.mode_set(mode='OBJECT')
# Get the active mesh
mesh = bpy.context.object.data
# Get the selected vertices
selected_verts = [v for v in mesh.vertices if v.select]
# Find the vertex with the minimum z-coordinate
min_vert = min(selected_verts, key=lambda v: v.co.z)
# Enter Edit Mode
bpy.ops.object.mode_set(mode='EDIT')
# Deselect all vertices
bpy.ops.mesh.select_all(action='DESELECT')
# Enter Object Mode
bpy.ops.object.mode_set(mode='OBJECT')
# Select the min z vertex
min_vert.select = True
# Enter Edit Mode
bpy.ops.object.mode_set(mode='EDIT')