Try to give it a cleaning with a CRC spray before anything else (the Maf and the contacts of the contacts), they usually get dirty and verify that none of the cables is peeled.
It seems to me and gives me the spine that the resistance of the MAF does not detect the air that crosses it and then does not inform the UCE of any air input, and if it does not receive a sign of the mass of air does not give the order to inject fuel, but when you disconnect it the UCE detects that there is no MAF since it does not give it feeding and adjusts to basic operating parameters.
The MAF sensor consists of a resistance that varies according to the input temperature and a hot sheet that is maintained at 70º degrees (the temperature of this is detected with a resistance). If the ambient temperature is 20º, it informs the UCE and in turn increases the feed voltage to the hot sheet to keep it at 70º. In this way the UCE makes the calculation.
Conclusion: If you do not solve it with the spray and the cables are correct and isolated change it since the failure P0102 indicates a cut to mass. All the best