Cervelli, 28, had played in parts of seven big-league seasons with the Yankees, who signed him as an amateur free agent out of Venezuela in 2003. But due to a series of injuries, Cervelli had appeared in just 69 games over the past three seasons.
The teams announced the deal in news releases Wednesday night.
In 2010, he played his closest to a full season, appearing in 93 games and batting .271 with no home runs and 38 RBIs. In his Yankees career, Cervelli batted .278 with 10 home runs and 92 RBI, and his enthusiastic on-field demeanor endeared him to fans even as it antagonized some opponents.
But with rise of young John Ryan Murphy, who leap-frogged Austin Romine in the Yankees' farm system as the catcher of the future, and the Yankees' penchant for stockpiling pitching, Cervelli became expendable.
Wilson, 27, was 3-4 with a 4.20 ERA in 70 appearances for the Pirates this past season but struck out 61 batters in 60 innings, a quality the Yankees covet in relievers, and curiously, has been more effective against right-handed hitters than against lefties in his career, holding them to a .206 batting average. Wilson was 6-1 with a 2.08 ERA in 2013.
Left-handers have hit .234 against Wilson in his three big-league seasons, and .253 in 2014. Overall, Wilson is 9-5 with a 2.99 ERA in 136 big-league appearances.
Information from ESPN.com senior writer Jerry Crasnick was used in this report.