Per the information you've provided it doesn't sound like the smog station tested the vehicle any different during the 1st and 2nd smog tests. It is very possibly your Ford Ranger passed the 2nd test with HC results which were still high, just not high enough to fail the smog inspection. With that said, a fault(s) probably still exists which is causing high HC. Read What would cause my car to produce high HC?
As far as the EVAP failure... it sounds like your Ford Ranger failed the LPFET (Low Pressure Fuel Evaporative Test). The Low Pressure Fuel Evaporative Test (also known as the EVAP test) ensures that there are no leaks between the vapor hose leading from the gas tank to charcoal canister, including the gas cap.
Here is how the EVAP system is tested: The LPFET involves the smog technician clamping the end of the hose leading to the charcoal canister and pressurize the gas tank with Nitrous Oxide via the LPFET test tool. The tool will then calculate the drop in pressure due to any leaks. There should be very little drop in pressure once the EVAP system (gas tank) is pressurized.
The fix involves locating the leak and repair the vapor hose, or component which is leaking. Depending on where the leak is located, this repair may be cheap or expensive, but the first step is to find where the leak is at. The gas cap test is conducted on a separate test machine which is attached to the smog check machine. The gas cap test is not part of the LPFET.