Unfortunately, there's no easy way to go to quepos from boquete/ david. Usually, people take the tica bus to san jose (8 hrs ride), but if you look at the map, it seems waste of time, going up and down again. Also, san jose doesn't interest many people since it's not exactly a tourist friendly city.
So here's how you do it - from david, take any Frontiera bus to the border town - Paso Canoas. Go to the immigration office, first Panamanian and then Costa Rican. At the panama office, you will get the exit stamp on your passport and then the Costa Rican officials will put an entry stamp on your passport. Unlucky travelers may get their baggage checked thoroughly and this may lead to an hour's waiting time, especially in the high season. In June (low-season), my experience was quite smooth and there was no waiting. It's as easy as buying a coca cola. It's important to do this process correctly, especially if you plan to reenter Panama during your trip. Also, you do get checked later on at a checkpoint and any negligence will result in a fine.
After this, take a taxi to the nearest bus station, Nelly. This is a quick 15 min ride which shouldn't cost you more than 2-3 dollars per person. From Nelly station, you can catch a direct bus to quepos, which is 4 to 6 hrs ride. There's a good chance that your next bus is hours away, since the frequency is pathetic - something like 2/3 buses per day.
So rather than suffering a long wait, take a bus to san isidiro which is also 4 to 6 hrs away in the same direction. The journey's duration is always unpredictable depending on the traffic situation. Roads are narrow, so the traffic makes a big difference. Plan this trip on a weekend to avoid the cargo trucks that normally ply on weekdays.
From san isidiro, quepos is a quick taxi ride away - 1 hr ride that costs 50 dollars. Or, depending on your arrival time, there may be a bus available. It's likely that it would be late evening, if you started from Boquete in the morning (and how long did you have to wait at each stop), so there's a good chance that you will spend those 50 dollars on the taxi for the last leg of your journey. To avoid this, a bus to San Jose (and then to Quepos) won't be bad option afterall.
1 hr = Boquete - David
1 hr = David - Paso Canoas
30 mins = Paso Canoas - Nelly
4/6 hr = Nelly - Quepos (if you can get the direct bus)