Where to start.
Yamaha, in fact all marine outboard manufacturers don't use tinned cable. Now it could be as simple as corrosion and a break in continuity but the fact it reset itself when you restarted, either points to the ignition wiring in the throttle box, wiring from the battery to a bus bar or similar or indeed the guage itself.
Have a look at the cable ends. When they are on their way out you'll see oxidisation and the copper turns green. You can wire up a continuity signal on a multimeter just to rule that out. A light sand with emery paper on the cable ends just buys you time. Rather than replace the entire loom you can strip-in some tinned cable. I'm sure the instrument loom joins the main loom tonthe engine via bullet connectors. Pull them apart, check the connectors, lightly sand and reconnect.
There also the instrument itself. If it was new with the engine, then we're talking 16 year old tech, so an intermittent fault isn't unheard of.
It's difficult to pinpoint - but hopefully that's given you some pointers. Also look at the wiring loom on the engine.