Be sure to work on the nonresident return first (NY), then the resident first (MA) for accurate calculations. Yes, you would file a nonresident New York return to recover what was incorrectly withheld.
Please see the TurboTax FAQ below regarding when you need to file a nonresident return for an out-of-state employer.
https://ttlc.intuit.com/replies/4776808