I had a very similar situation last month with my Samsung STB to Marantz SR 8500 using toslink. And I discovered in much the same way you did--by changing out a component.
What I eventually found is that the toslink cable was the culprit! If subjected to the slightest "jostle" it would drop signal. Another jiggle and the signal would restore.
This wasn't conclusive enough to blame the cable, but I decided to swap it out as a way to isolate it as a cause. I expected the STB to be the problem (it's older, runs hot, and sometimes gets a bit 'quirky').
After I replaced the toslink cable, the problem disappeared. I assume that had the problem been with either component, the issue would have remained. Nevertheless, because it was an intermittent problem, it took some waiting before I deduced that the cable truly was at fault.
Looking back on 30 years in this hobby, I've only had one actual component fail, but have gone through many cables. Ironically, it's usually the last thing I check (sound of palm smacking forehead) when troubleshooting!