Be sure to scroll down... there may be more than one question on this page!
Water (or water vapor) bringing "something" through the subfloor into the carpet is probably causing the stain. It could be mildew growth or it could be some sort of chemical stain. Since it is only around the perimeter, I am wondering if perhaps some sort of sealant or plastic tarp was used to cover the slab and moisture is leaking around the edges, producing the damp spots.
You may want to take up some of the subfloor and look underneath the see what's going on. If there is excessive moisture, you might want to remove the entire subfloor and seal the slab with waterproof cement paint. I would consult your local hardware or home store to find the correct product for this application in your area.
If they are not already installed, laying overlapping plastic tarps on the slab will also decrease the moisture infiltration. They should overlap at least a few feet and be pressed tightly around the perimeter of the slab. Ideally, the perimeter should be held in place mechanically with wood strips nailed to the slab. In inaccessible areas, one trick that can be used is to pour sand or gravel over the tarp to stabilize it.
You could, of course, consider putting down heavy plastic tarps underneath the carpet and padding. My advice is… DON'T DO IT! This would indeed isolate the carpet from whatever is causing the problem, but... a really BIG but... you will also be sealing the subfloor as well, and the additional persistent moisture will speed the growth of wood rot fungus.
Its difficult to know for sure why you are having this problem, but what is sure is that you have an air leak coming under the base molding, blowing oily dust or dirt onto the carpet. Odds are, there is an air space between the floor and the wall, allowing air to enter your room from the hollow in the wall or from the basement/ floor below.
What you need to do is seal the leak. The more difficult way would be to remove the base molding and install some sort of air barrier... depending on the size of the leak you could use a strip of plastic or even a foam insulation pressed into the gap.
Since I can reasonably guess that you would prefer a less destructive solution, try this...
Pull the carpet back from the areas where you have the leakage. You will probably see a gap under the moldings where the air is entering. Purchase some strip foam insulation... this product is available in a number of sizes. Don't buy the kind with a glue strip... it is unnecessary and probably will make installation difficult or impossible. The type I mean is the type used to weather strip air conditioners... just ask... all the good hardware store guys will know what I am talking about.
Again, depending on the size of the gap, you may have to cut the foam insulation into a thinner strip. Plain old scissors will do the job nicely. Push the foam into the gap between the base molding and the floor. This will stop the air infiltration dead in its tracks, along with the staining!
Usually these persistent recurring accumulations of dust and dirt are related to condensation and temperature variations. The stains often seem to follow the line of the ceiling joists and sometimes wall studs on outside walls. The joists create a direct path for the cold from the attic to enter your living space! This is because wood is less of an insulator than the rolled or loose insulation between the joists on the attic floor.
These cold spots cause normal home moisture to condense on the ceiling… not enough to drip but enough to act as a "dust magnet" and, over time, cause the telltale accumulations of dirt and subsequent staining.
Repainting will eliminate the stains for a while, but because you have not addressed the cause of the staining it will recur eventually. Using an eggshell (or glossier) finish paint instead of flat will help make the surface easier to clean.
One way to lessen this problem is to add insulation to the attic across the tops of the joists. This will equalize the temperature of the ceiling and (hopefully) eliminate the recurring stains.
You mentioned your natural gas appliances. One of the main byproducts of burning natural gas is water vapor. This additional moisture can be a problem in some homes, especially new homes that are built to be very weather-tight. You can lessen the moisture by increasing ventilation... use the exhaust fan over the stove whenever possible, use the exhaust fans in the bathrooms, etc... even open a window!
Hope this helps!