The directed flow of particles produced in ultrarelativistic heavy ion collisions at SPS and RHIC is so small that currently available methods of analysis are at the border of applicability. Standard two-particle and flow-vector methods are biased by large nonflow correlations. On the other hand, cumulants of four-particle correlations, which are free from this bias, are plagued by large statistical errors. Here, we present a new method based on three-particle correlations, which uses the property that elliptic flow is large at these energies. This method may also be useful at intermediate energies, near the balance energy where directed flow vanishes.