While "The Star Trek Encyclopedia" generally sticks with canon, or acknowledges when not - especially when dealing with classes and registries of Star Ships, combining it and a listing of Wiki "Lists of Starfleet Starships" I total approximately 300 in Classes, from A to Z, including "non-starships", refits, support ships and non-canon ships referenced in paper publications...if it is reasonable to calculate an average of 20-40 ships in each class, a VERY rough estimate, i freely admit, than I think there could be 8000 or more ships total...
...excluding the non-canon, non-star ships, support ships, and the like, the total is approximately 220 ships in each class, A to Z...
...these totals are not definitive, but I did spend some time with the sources listed below, culling novel- mentioned and alternate timeline ships...the totals do include both NCC and NX...In the canon totals, I did my best to include truly canon ships...
http://en.m.wikipedia.org/wiki/List_of_Starfleet_starships_ordered_by_class
The Star Trek Encyclopedia: A Reference Guide to the Future / Updated and Expanded Edition by Michael; Okuda, Denise; with Debbie Mirek Okuda (1997)
I also found a source, lists below, that estimated 30,000, but I think that is a little high...IMHO
http://www.ditl.org/searchdisplay-page.php