Ansarifard was on hand in the 34th minute to put the Cypriot side into the lead in the first half.
Marcus Rashford equalized in the second half before assisting the other substitute Anthony Martial to put United in the lead and save it from a shock defeat.
Omonia lost the game 3-2 on their own turf.
Despite the defeat, the 32-year-old Iranian forward made headlines for his goal.
Ansarifard has played for Forest and it sister club Olympiacos, AEK Athens, and the Qatari side al-Sailiya, and joined Omonia this summer.