sounds like it could be the in tank sensor... which is very possible.... might have to change the in-tank pump... if i remember right the sensor for the fuel gauge is built onto the fuel pump... thats atleast the way it was on my little ranger... i havent pulled a mazda tank yet... havent needed to...
There is a float in the tank with some tabs on it, as the tabs wear they don't make good contact and the gauge doesn't read or read right. All you have to do is pull the gauge and bend the tabs so they make better contact.
At least that's what I think you need to do.
the sensor is attached to the sending unit in the tank, you can buy the part at the dealer, i know its about 45$ cdn, its really not that hard, if you want to make it easy, pull the bed off the truck, it'll be easier to get to the fuel lines to disconnect them, and pull the sending unit out that way, you wont have to pull the tank off you wont even have to lift the truck up