Speed gained by gravitational sling shot... how?

ok I am rusty, and I want appear smart arse but forgotten the mechanics

probes gain speed by diving towards a planet, reaching greater than escape velocity and shooting off the other side

f= ma
p=mv

the planet has greater mass, the force acting between the two objects is equal, hence the accelleration of the probe is greater?