node_save() casing 500 Internal Server Error - 48s when using with AJAX
Sorry, I don't have enough reputation points to comment so I should post this as an answer.
Obviously your 500 error comes from the script. The node_save($node); does not cause your error, it's just the trigger.
If you want to follow the best coding practices, you should use try and catch blocks to catch your errors before you try to modify your database.
If the "dblog" module is activated you could follow the error stack to debug your script or else you could comment out all of the lines that are assigning new values to your variables and start re-executing your script by uncommenting one line at the time utill the error is reproduced.
I hope that this helps a bit. We have all been there. Cheers.