The transverse momentum ($p_t$) dependence of hadron flow at SPS energies is studied. In particular, the nucleon and pion flow in S+S and Pb+Pb collisions at 160 AGeV is investigated. For simulations the microscopic quark-gluon string model (QGSM) is applied. It is found that the directed flow of pions $v_1(y, \Delta p_t)$ changes sign from a negative slope in the low-$p_t$ region to a positive slope at $p_t \geq 0.6$ GeV/c as recently also observed experimentally. The change of the flow behaviour can be explained by early emission times for high-$p_t$ pions. We further found that a substantial amount of high-$p_t$ pions are produced in the very first primary NN collisions at the surface region of the touching nuclei. Thus, at SPS energies high-$p_t$ nucleons seem to be a better probe for the hot and dense early phase of nuclear collisions than high-$p_t$ pions. Both, in the light and in the heavy system the pion directed flow $v_1(p_t, \Delta y)$ exhibits large negative values when the transverse momentum approaches zero, as also seen experimentally in Pb+Pb collisions. It is found that this effect is caused by nuclear shadowing. The proton flow, in contrary, shows the typical linear increase with rising $p_t$.