On the winning play, Ferreira and Brek Shea attacked defender Nat Borchers on a 2-on-1. Borchers went for Shea, who sent a pass to Ferreira in the middle.
The Dallas midfielder controlled the ball, then unleashed a volley into the top-right corner past Salt Lake goalkeeper Nick Rimando in the 94th minute.
Fabian Castillo scored in the 61st minute for Dallas (8-11-8), which pulled to within five points of the fifth and final playoff spot in the Western Conference.
Alvaro Saborio equalized in the 76th minute for Salt Lake (13-10-3), which dropped its fourth straight.