the fuel pump was my first thought too....a suspect fuel pump won't set a code, but a misfire due to lean would and could also go away just as fast....the only way I can check a fuel pump is at the rail with a pressure gauge.
how does it run when not pulling the trailer? Can you get to speed?
here's the nerd part: A random misfire code usually means the air/fuel mixture is running lean. But the cause might be anything from a hard-to-find vacuum leak to dirty fuel injectors, crank sensor failing, low fuel pressure, a weak ignition coil, bad plug wires, or compression problems. Now....dirty injectors are something I'm always on the lookout for since the only fuel filtering in these trucks takes place at the pickup sock in the tank. The pick up sock isn't nearly as effective at filtering as a standard in line filter can is, once that sock loads up with crap, a lean fuel condition at speed or under load is highly possible. Enough time, enough bad gas, enough gunk or varnish and then next check to make.... eventually it's injector time. if you get a random misfire code that lights up and then goes away, intermittently...suspect the fuel pump first. If that is the code you pull and it becomes permanently lit up, you may have a full blown Easter egg hunt on your hands.
Now, what if you don't have a stored code.....get around back with the engine running and have someone else rev the engine to around 3000 rpm. With your hand near, but not too near the exhaust pipe, try to feel for good flow. If you can't get to 3000 rpm or you get a sputtering and it seems like the exhaust is weak, you may be dealing with clogged cat(s).