They both serve a different purpose, and are used internally by Windows Explorer for saving info about the folders.
Thumbs.db: Is a cache of image thumbnails for the files. When you use thumbnail folder view and there are picture files in some folder, Windows creates a small version out of it for displaying. This small version (the thumbnail) is stored in the thumbs.db file, for speeding up the next time you open the folder (it reads it directly from there instead of recalculating it).
Desktop.ini: This one stores additional per-folder configuration, settings or preferences for individual folders. It for example saves the "personalize" settings tab on folder properties, the background image, a possible alternative icon, an alternative name, or a different configuration for displaying Explorer columns. Every thing that causes Explorer to display something different from a normal folder is stored there. It's also created automatically when you make some customization, by certain installers that meddle with Explorer settings, or come a lot by default with Windows for some special foldes.
Generally, both files are mostly useless (particularly thumbs.db) and can be safely deleted, unless you know they serve a purpose. I simply delete any one of those pesky things I see, they serve no useful purpose on the system really.