I had what sounds like the same problem with the same engine in my Hunter 49. After the engine ran for an extended period, it would usually stall when brought down to idle speed. Sometimes it would go into neutral without stalling but then it would stall when shifted into gear. Sometimes it would restart right away but often it would not start until it had rested for 30-45 minutes.
After trying all of the things that have been mentioned, and more, over a period of several years, the Yanmar Distributor suggested the problem was the Fuel Injector Pump Assembly (I think I have the name right but will check when I find the bill to confirm). They thought it had to be calibrated or replaced. I think the calibration has to be done at a regional service center.
We were enroute from Florida to the Chesapeake when we decided we had to try this.
We didn't want to take the week or two it would take to have it sent in to be checked and calibrated so we replaced it. (There were two available in the U.S. at the time.)
Since it was replaced, we have had absolutely no problem despite some pretty heavy usage on the ICW.
This unit is at the bottom starboard side of the engine, difficult to reach or see. The mechanic who did ours was a very experienced Yanmar mechanic but it took a full day to remove the old unit and install the new.
I will double check the name of the unit and re-post it if this one is wrong.
We tried everything possible for several years, found no help, and got into some pretty hairy (scary) situations along the way. Also, if this had been correctly diagnosed when the problem started, it would probably have still been under warranty.
Good Luck.