Ujah’s Nigerian teammate and Super Eagles defender Leon Balogun also in action for Mainz at the Kybunpark Stadium in St. Gallen.
After a 0-0 first half, Ujah broke the deadlock in the 47th minute to put Mainz 1-0 up.
St Fallen struck back as Boris Basic equalised in the 64th minute.
And in the 76th minute, substitute Kenan Kodro scored the winner to give Mainz a 2-1 win.
Mainz will host fellow Bundesliga club Borussia Monchengladbach in another friendly game on Sunday.
They will return to action in the Bundesliga when they visit Hannover 96 on January 13 in their first game of the second half of the season.
They are currently 15th on 17 points, one place above the relegation play-off spot in the 18-team league table.
Ujah first signed for Mainz in 2011 before departing for Cologne in 2013.