The nearest train station to Vilamoura is Loulé Station. Trains from Faro to Lisbon stop there. However, it is about 15 mins by car/taxi from Vilamoura. There is no direct bus service. One would have to go to Quarteira Bus Station and then get one of the hourly buses to Loulé 4 Estradas.
Alternatively you could get a bus from Vilamoura to Faro.. first service is at 08:00. This takes 40 mins.
Personally, I would recommend that you avoid all this hassle and take a bus. There are three companies operating the route
1) Eva Transportes - operates to Lisbon Sete Rios Bus Station
I have uploaded the timetable in pdf format here:
2) RENEX - Operates to Lisbon Gare Oriente Bus Station
If you go to my blog at:
Scroll down on the right hand panel until you come to the section entitled:
»» Algarve & Portugal - Travel Transport Links
You will find a link to the Renex Bus Timetable entitled:
»» RENEX Bus Service - Lisbon to Algarve (including Lagos) timetable
Click on it and you will be able to download the timetable in pdf format.
3) http://www.rede-expressos.pt/ - operates to Lisbon Sete Rios Bus Station
National Bus Company. Operates some services in co-operation with EVA.
Returning to Faro you could also consider the train.
See http://www.cp.pt (Click on uk flag for english version)