This paper discusses the vernacular novel Haishang fanhua meng 海上繁華夢 (Dreams of Shanghai Splendor), written by Sun Jiazhen 孫家振 (1863–1939) and published in instalments from 1898 onwards in Shanghai. Even if the novel became a best-seller following its publication, it has been continuously overlooked by historians of literature and rejected due to its alleged “lack of quality”. This paper proves the opposite. A narratological analysis shows the novel to be highly innovative in format, style and setting, yet also deeply interwoven with, and conscious of, its literary ancestors. The novel is usually categorised as a “courtesan novel”. According to Alexander Des Forges’ research, it can however be read as one of the first in the genre of the “Shanghai novel”. In addition, the metropolis Shanghai is portrayed as a completely different world in contrast to the rest of Qing China. This other-world phenomenon is in accordance with Michel Foucault’s theory of heterotopia: it describes places and institutions in society that stand in sharp contrast to the reputed normalcy and continuity of everyday spaces. The paper concludes with the successful application of Foucault’s theory to the Shanghai novel Haishang fanhua meng. It proves how Shanghai at the turn of the century has indeed been perceived as, and serves as, a heterotopia within China’s society. Last but not least, it proves that the onset of the genre of the Shanghai novel can indeed be set at the end of the 19th century.