Technically, this isn't entirely about top speed - it's also about acceleration. A rocket (or other propelled object, such as a YT-1300 Corellian Light Freighter) does not need to reach escape velocity to exit a gravity well, but it does need to overcome the acceleration due to gravity.
Since gravity is inversely proportional to the square of distance, a ship with a higher maximum acceleration can get "deeper" and still escape. For example, if it takes an acceleration of 4 kellicams per lup2 to escape at 5 units from an object's centre of mass, then it takes only 1 kellicams per lup2 at 10 units, 6.25 kellicams per lup2 at 4 units from the object's centre of mass, or a whopping 100 kellicams per lup2 at 1 unit.
As such, a ship with 60% more acceleration (in this case of 5-units out) can cut 1 unit closer to the object without crashing and burning. Much like a racing line on a corner, this is a shorter distance.
A ship moving sufficiently fast can 'lose' more speed to gravity and maintain an escape velocity, which allows it to slip closer to the stellar mass than pure acceleration would allow it to - so long as it is able to get back out far enough for acceleration to overcome gravity before it stops. A bit like taking a run-up versus a standing jump. This is essentially a flyby