CTS obviously has a vested interest in omitting any mention of visa at border option. Nationals of most countries can get a single-entry visa limited to Shenzhen (maybe 5 days validity - not sure) at the Lowu border between HK and Mainland immigration counters. Unless your country is on the list in the CTS website (in which case either you need a visa beforehand, or you pay (or wait) more), fee is generally is HKD 150. Even on a Saturday morning I've seen it done by Canadians, Swedes, Malaysians and Indians among others in less than 15 min. The wait in the actual foreigner immigration queue thereafter is longer. Having your own pen helps. No need for photograph. But visa office is not open 24 hrs - maybe 8am to 8pm - not sure.
No first hand experience, but it seems it can also be done at Lok Ma Chau border. See
http://wikitravel.org/en/Hong_Kong .