I have made, assembled and repaired computers, cables, and PC boards.
There are a few things I have seen that may be causing your problems.
One is when the wire is put into the pin on the connector on the cable (If its a crimp style cable.) some times the wire will be pushed too far into the pin when the pin is crimped and then the pin won't seat right in the connector.
Another problem is solder or even a scrap piece of metal, etc. from the manufacturing process can get into the female socket part of the connector and push the pin out of the opposite male connector (I've seen this on cable and PC board connectors.). This can cause the connection to be intermittent.
If either the cable or the computer uses an insulation displacement connector(Ribbon cable, etc.). These some times have crimp problems, wire damage or even metal, etc. from the manufacturing process in the crimp. These can also be intermittent.
You could even have a bad solder joint or trace on the laptops circuit board. And again we have an intermittent connection.
Also with these small fragile connectors a pin can easily be bent or broken off. And again we can have connection problems.
Now your probably wondering how a hardware problem can affect a config file? It is because some of the pins in that mini VGA connector are used to identify the monitor type and resolutions to the system. Then that config file is written from the type ID'ed You could turn off auto monitor type detection for that laptops video(Not all video(Drivers) have this option and it may stop the laptop from seeing the monitor when you plug it in.).
I would try a new cable first. You can probably do this for free just take that laptop, monitor, and cable to the computer store you got it at, or a local computer store that sells laptops of that type and cables for them.
You may be able to see something in the sockets of the female end of that mini VGA(Bright light, magnifying glass and good eyesight are needed here.), or see if one of the pins or sockets are not seated, or if they are sticking out all the way on the male end, or are even bent or broken off.
Anyway I hope this helps, I know what a royal pain these little nagging problems ca be from both ends, as a computer user and as a tech support.
Remember, try the obvious things first!