If you balance the forces due to the electric and the magnetic fields on the charged particle in such a way that there is no resultant force on the charged particle, then that is called a velocity selector. It means that the Lorentz force on the particle is 0.
$$ F =Q(E + v \times B) = 0$$
This allows you to measure the velocity of the charged particles emitted (incoming cathode rays into the setup in Thomson's case), which let us assume is in the $y$-direction, with the potential difference in the $x$-direction and and magnetic field in the $z$ direction. After that Thomson, switched off the magnetic field and measured the deflection as the cathode rays came out of the setup. The deflection was given by
$$\tan\theta = \dfrac{qVa}{mhv^2}$$
where $V$ is the applied potential difference, $h$ is the separation of the plates of exerted potential difference, where $a$ is the distance it travels in the y direction through the electric field in the setup and $v$ is already found out using the velocity selector. So Thomson could find out $q/m$ as he had knowledge of all other quantities.