This theory of 'flying fast enough' seems to be backed up by the ST Enterprises' slingshot effect maneuver in IV: The Voyage Home and otherother episodes, and also backed up by some science:
Wikipedia: In orbital mechanics and aerospace engineering, a gravitational slingshot, gravity assist maneuver, or swing-by is the use of the relative movement and gravity of a planet or other celestial body to alter the path and speed of a spacecraft, typically in order to save propellant, time, and expense. Gravity assistance can be used to accelerate (both positively and negatively) and/or re-direct the path of a spacecraft.
The "assist" is provided by the motion of the gravitating body as it pulls on the spacecraft.1 The technique was first proposed as a mid-course manoeuvre in 1961, and used by interplanetary probes from Mariner 10 onwards, including the two Voyager probes' notable fly-bys of Jupiter and Saturn.