Yep, I looked into this when planning our Sept '07 trip. Basically, there are almost no rail connections between the Costa del Sol and the Algarve. The bus that X-Ring mentions is probably your best choice.
In the end, it made our decision easy to just rent a car instead for our vacation.
-Bob