If overnighting I would go with HKG. PEK is too far from city center, and traffic is horrendous during the day. Ditto for SHA-PVG.
I've overnighted in HKG four-five times over the last two years, coming from places such as Wuyishan, Chengdu, and Chaozhou. I prefer staying in Kowloon instead of Hongkong island because it is just that little closer on the Airport Express, which can get you to and fro in about 20 minutes. The connector bus can take you to the major hotels. On the way back you can check your bags and get boarding passes before stepping onto the train, but mind the 90-minute cutoff. There are plenty things to see and do and eat in Hongkong/Kowloon/Outer Islands to make the short stay worthwhile, imo. Last August I took the ferry and spent the evening in Lamma, a car-less island. It allowed me to wind down and relax after a stressful trip, and made the HKG-SFO flight the next day that much more enjoyable.