Aero - I have spent a little time looking at the Foobar SDK and it looks like it should support all the metadata/"media library" functionality you would need to do your playcount/ratings/GUID storage. Much of it looks to be in metadb.* and metadb_handle.*.
I haven't actually tried writing any test components to see how these functions behave but here's a few that I ran into looking through the SDK source.
in metadb.h:
// returns a list of metadb_handle's of everything in the database
metadb::get_all_entries(ptr_list_base<metadb_handle> & out)
// update the database from 'info', which contains meta fields
metadb::update_info(const file_info * info,bool dbonly=false);//using playable_location from file_info, return -1 on failure, 0 if pending, 1 on immediate success; may take a few good seconds to execute
in metadb_handle.h:
// for a given metadb_handle, get the value for a specific meta field
metadb_handle::handle_query_meta_field(const char * name,int num,string_base & out)
I'm not sure if there is a get_metadb_handles_matching_meta_field() type of function in there, I'm not too familiar with this code. Obviously it can be done manually by iterating over the list returned by get_all_entries(), using handle_query_meta_field(), which is probably what the SDK would have to do if it does provide such a function already. I would doubt the meta fields are indexed.
I also see that the author of foo_dbsearch apparently created a mini SDK for database querying, this seems to simplify things quite a bit:
http://www.stud.uni-karlsruhe.de/~uzbs/fb2k/foo_dbsearch
Hope this helps!