Ah, I had hopes pinned on the idea that I just wasn’t
smart enough to figure it out, but it’s an inherent limitation. I
will be using your function though—that is a clean way to encapsulate the
functionality.

You have to do it in two steps, like is explained in the
operator page.
One faster step to reduce the candidates (by using <-> or <#>) and
second one to get the real distances with ST_Distance.

The problem in finding the KNN for each row in a table is
the fact that the gist index <-> operator only works if one of the
geometries is constant. The workaround would be to create a SQL function to
apply to each of the rows using table.the_geom as a parameter.

ORDER BY veg.gid,
ST_Distance(veg.the_geom,ground.the_geom)) AS vegpoints;

ST_DWithin
prevents a full cross join, but is a sloppy way to do this, as it requires a
priori knowledge of the end cases. I’m hoping there’s a
subquery or some such magic that would allow me to use the distance operator to
a similar end… .