first: you don't need to parse the unique id to string - the unique id is always a string (even if it contains digits only).
The "not a valid number" issue is caused by the calculation field sandbox view produces the preview. Under certain circumstances the sandbox expects that a string is returned even if you have parsed the string to a number (it's a bit more complex).
You need to "persuade" Podio to accept the result as a number. This can be done by adding || 0 (read as: else 0) behind the result (instead of 0 you can use any number). That convinces Podio to accept the result as a number.
var id = @Unique ID.replace(/F0/g,"");
var num = Number(id) || 0;
num - 18947