Cities of the Red Night: A Novel by William S. Burroughs
Clem Snide, a private detective, has to solve a case of ritual murder. In the Gobi Desert 100,000 years ago, a red virus has erupted. And in the 18th century, gay pirates have set up their own republics in South America and are at war with the conquistadors. All three stories are merged at the end in a giant trans-time, trans-space battle.