Fuel tank leak detection system, and this is a common cause....
This system pressurizes the fuel system every fifth (or so) start-up so check for leaks. There could be a legitimate leak, a faulty gas cap, or a problem with the wiring. Seems that BMW routed the wiring for this unit between a hose and the driver-rear plastic inner fender well. The wire eventually wears through and the ECU doesn't get a a good response from the system, therefore it issues the P1442 fault code.
So if you have replaced the gas cap and the light and same code come up, I would check out the wiring to see if any wires have frayed over time. If all wires look ok to you, then you have to check the gas tank itself and the hoses/pipe that connect to it.