Gave this one some thought - due to OKC's tax situation reducing that bill is paramount for them, but I assume they'd prefer to keep adding to the team as well after laying out all that cash for George and Grant.
THJr is a non-starter, too much money and too many years. I think a trade could be engineered to provide OKC with significant tax savings though, along the lines of the following:
Courtney Lee - $12,253,780
Lance Thomas - $7,119,650
Ron Baker - $4,544,000
Troy Williams - $1,544,951
Total Outgoing: $25,246,381 (with the 125% rule, the Knicks can take back a maximum of $31,557,976)
For
Melo - $27,928,140
T.Ferguson -$2,118,840
Dakari Johnson - $1,378,242
Total Incoming: $31,425,222
(I tried to make it work without Williams and Johnson at first, but it was just barely over the 125% rule, so swapping Williams and Johnson is needed to make it a legal trade.)
The exchange by itself saves the Thunder 6.2 million. Additionally, I would expect them to waive/stretch Lance Thomas and Ron Baker for additional savings. Lance's contract is good for this since he technically has 2 years left, but the second year is only guaranteed $1 mil. So his remaining guaranteed $(8.12m) can be stretched over 5 years at a cap hit of only 1.63m. Ron Baker's contract stretched over 3 years would be 1.52 mil cap hit.
So the final exchange if this worked would look something like this from OKC's standpoint -
31.4m outgoing, 16.9m incoming (Lee's 12.25m + Williams 1.5 + 3.15 in 'dead money' from the stretched LT/Baker contracts) - That's a 14.5m savings for the Thunder, which is huge given where they are tax-wise. Comparatively, just stretching Melo's last year out over 3 saves them 18.6m this year, while adding nothing to their team and leaves them with a 9.3m dead money hit in years 2 and 3 for the stretch. In exchange for a little less savings they get a very useful role player in Courtney Lee for their quasi-contender. The dead money is only 3.15 mil for the first 3 years and 1.63 mil for 2 years after that. I expect they'll waive and stretch Singler as well (like LT, his can be stretched over 5 years) to save even more on their tax bill. All this trade costs them is T.Ferg and a swap of end of the bench players. I think this passes the 'mirror test' from OKC's standpoint.
For the Knicks, they get another young piece in T.Ferg on a rookie deal and generate 11 million in additional 2019 cap space. Melo would be waived immediately and free to sign with the Lakers or Rockets so there would be no reason for him to invoke his NTC.
Edit: Forgot to include T. Willams' salary in the exchange, now corrected.