Ty Albrecht struck at 5:23 of the third to tie the Saskatchewan Junior Hockey League contest.
Tye Scherger gave the Mustangs the lead at 12:43 with Ben Tkachuk adding the insurance marker at 14:45. Both goals came on the powerplay.
The host Terriers had a 1-0 lead after 20-minutes at the Westland Arena on a goal by Carson Henry 8:30 into the game.
In the second a goal by Boston Maxwell at 2:32 tied the contest 1-1.
Maddux Nollski game Yorkton a 2-1 lead with an unassisted marker at 12:04 of the middle frame.
The lead grew to 3-1 on a powerplay goal by Tyson Perkins at 14:50.
Marco Lopez drew the Mustangs within one at 3-2 with a goal with only 43 ticks left on the clock in the second period.
Joel Favreau was the winning netminder facing 31 shots in the Melfort net, while Jacob Herman took the loss facing 26 shots for Yorkton.
The loss was the third straight to start the season for Yorkton, while Melfort moves to 2-1.
Next action for Yorkton will see the Terriers host Weyburn Thursday, while Melfort heads to Nipawin Friday.