Wow that atomic force microscopy is a new thing for me, thanks for the link!
Your question is both very simple and very complicated, and I'm not the best person who will (hopefully) respond, but I'd like to start the conversation.
Lewis structures are a simplification of molecule shapes and orientations. Some molecules are stable in a single, two-dimensional orientation, and those are probably the best ones to view using atomic force microscopy, as most molecules in solution are changing constantly or, if crystalized, would be found in several different orientations.
In general, the lewis structure is a theoretical illustration of a molecule that is useful for illustrating interactions and reactions; it is not an actual literal image of the molecule. Over time, these models have been verified via a number of different methods (x-ray crystallography, separation techniques, MS, etc) which either visualize the substance's molecular structure, or interact with functional groups on complicated molecules in a predictable way.
As far as knowing what a peak is indicating relative to a particular molecule, running pure compounds as standards is how they are correlated. Compounds with particular functional groups will go through the MS in different, predictable ways. Once these patterns are correlated to a pure substance, you can look for them in unknown samples.
This is very different from going from a peak to a lewis structure directly. You can infer the structure of a molecule based on the pieces of it that pass through an MS System in a particular order, and you can infer the relative amounts of each portion of the molecular structure to make predictions, but it doesn't directly give you a lewis structure just by looking at the peaks.
Spectra identify the molecules that go through the system, they don't identify the shape of the molecules. For newly synthesized molecules, that is done later with chemical theory and tried and tested results from years and years of experimental data. For molecules that have already been identified previously, these data are just matched to previously defined molecule with an established set of identifying spectra.
As far as analyzing for samples that have no matching spectra: usually you aren't looking for the ID of a truly random sample. You'll know if it's soil or a metal, a lipid or a tissue. Based on the starting information, you can begin to screen through spectra of pure substances you would expect to show up in order to identify your unknown.
I hope this makes sense and - again - I'm not the most knowledgeable here, but maybe it'll get you pointed in the right direction and start a conversation with people who know more than I.
Cheers!