Low idle and stumbling/dying when in gear after warmup. Also, after driving for 5-10 minutes, shutting the engine off for 5-10 minutes, then restarting, the Service Engine Light comes on briefly then the light goes off as vehicle is driven and engine speed increases. Service Codes 22 and 42 are stored. It is a 1991 Chev K1500 5.7l TBI
Generally I would start with a good tune up consisting of New spark plugs and wires along with an air filter replacement. Make sure all battery contacts are clean and free of corrosion. Make sure the battery is fully charged.
If this is something that just all of the sudden happened I would try to remember if you just filled the tank. More often then not refueling with some bad fuel will cause issues.
Lets assume for a moment that your fuel is good and so are the plugs, etc. The next thing I would do would be to clean the throat of the throttle body and the butterfly. This vehicle is old and odds are it has built up some carbon in these areas and is restricting the flow of air just enough to cause you a headache.
Clean the Throttle Body
With the engine off spray starting fluid on a rag and wipe the inside walls of the throttle body. and Do the same for the butterfly. Pay most attention to where the butterfly rests in the throat of the throttle body.
If positive results are not achieved then I would move to checking for voltage reference at the TPS and start checking the wiring going to it.