I was thinking that on a fly-by of the moon, due to a lack of atmosphere, you could get really close! Of course, in practice this isnt a very good idea- going 1000m/s 50 meters above ground wouldn't allow for all that much more science and would allow for tons more risk. That being said, what is the closest fly-by ever completed and by what spacecraft? This can include captures, but should only consider the initial perigee of the trajectory before capture burns. For planets without atmosphere the height should be from the surface. For planets with atmosphere the height should be from the karman line of that body (or the surface- whichever makes more sense given the scenario Im assuming no flyby ever intends to dip below the atmosphere of a planet at hyperbolic speeds aside from aerocaptures- which would count).
Here's a list of what the closest flybys that I have found of several objects. For Cassini and Galileo, I took the closest approaches they had to any object, pre-impact.
- Earth: Galileo- 301 km
- Moon- Apollo 13- 254 km
- Mars- Rosetta- 250 km
- Mercury- Messenger- 200 km
- Amalthea- Galileo- 160 km
- Enceladus- Cassini- 25 km
I guess the gas giant moons were selected because a significant amount of time was present to get a good orbital trajectory, and the orbits are relatively short. It could be known with precision where the spacecraft would be. With, say Pluto, the knowledge of where it is is only to within a thousand kilometers or so, so some margin for error is required!
I might add to the list the Apollo X LM Snoopy, which came within 14.4km of the Moon's surface with Gene Cernan (LMP) and Tom Stafford (CDR) aboard in May 1969. Snoopy descended toward the lunar surface about as close as subsequent landing missions would when they began powered descent; instead, the LM's descent stage was jettisoned and its ascent engine was fired. Due to an error, Cernan and Stafford entered a roll while the ascent engine was firing from which they almost could not have recovered.
As an interesting aside, the ascent engine was designed to be ridiculously reliable; it used no pumps and no ignition system, as its propellants were hypergolic (i.e., reacted on contact). But because the fuel was so corrosive, the engine would have to be rebuilt after it was ignited...which meant that any given engine that was ready for flight could not be tested; a descent abort or its nominal use for leaving the Moon's surface would be its first and only operation.