The loss was only the second of the year for New York, who drops to 8-2 on the season.
In addition to Mayo, Vince Carter came off the bench to score 25 to help lead the Mavericks, who are now 7-6.
Carmelo Anthony led the Knicks in scoring with 23 points. Tyson Chandler posted a double-double with 21 points and 13 rebounds, while Raymond Felton had 18 points and 11 assists.
The Knicks held a five-point lead at halftime, but were outscored by nine in the third quarter. Mayo scored 12 points in the third, including seven in the final 2:41.
Both teams posted similar shooting numbers, with the Mavericks making 49.4 percent of their attempts and the Knicks shooting 50.6 percent.
Dallas, however, out-rebounded New York, 42 to 37, led by eight from Elton Brand. Mayo was the only Dallas player to appear in the game and not record a rebound.
The Knicks travel to Houston Friday to face the Rockets and old friend Jeremy Lin.