You're right. The piston can gain kinetic energy and overshoot its equilibrium position, but then, the force of the gas on the piston will drop until the piston comes back the other way. The piston will undergo an oscillation back and forth, but this oscillation will be damped as a result of viscous dissipation stresses in the gas. Eventually, the oscillation will decay until the piston stops. At this point, the gas pressure will be in equilibrium with the lower pressure outside.
If I do a force balance (Newton's 2nd law) on the piston, I get
$$F_\mathrm{g} - p_0 A = m \frac{\mathrm{d}v}{\mathrm{d}t},$$
where $F_\mathrm{g}$ is the force the gas exerts on the piston, $p_0$ is the outside pressure, $A$ is the piston cross sectional area, $m$ is the mass of the piston, and $v$ is the piston velocity. If I multiply this equation by the velocity of the piston $v = \mathrm{d}x/\mathrm{d}t$, and integrate with respect to time, I obtain:
$$
W_\mathrm{g}(t)
= \int\limits_0^{x(t)} F_\mathrm{g}\,\mathrm{d}x
= p_0(V(t) - V(0)) + m\frac{v(t)^2}{2},
$$
where $W_\mathrm{g}(t)$ is the work done by the gas on the piston (its surroundings) up to time $t$, $V(t)$ is the gas volume at time $t$, and $m\frac{v(t)^2}{2}$ is the kinetic energy of the piston at time $t$. At infinite time, the piston is no longer moving, so its kinetic energy is zero at final equilibrium. Therefore, at final equilibrium, the work done by the gas is just
$$W_\mathrm{g}(\infty) = p_0\Delta V,
\text{ where } \Delta V = V(\infty)-V_0.$$