We use product systems of C∗-correspondences to introduce twisted C∗-algebras of topological higher-rank graphs. We define the notion of a continuous T-valued 2-cocycle on a topological higher-rank graph, and present examples of such cocycles on large classes of topological higher-rank graphs. To every proper, source-free topological higher-rank graph Λ, and continuous T-valued 2-cocycle c on Λ, we associate a product system X of C0(Λ0)-correspondences built from finite paths in Λ. We define the twisted Cuntz--Krieger algebra C∗(Λ,c) to be the Cuntz--Pimsner algebra O(X), and we define the twisted Toeplitz algebra TC∗(Λ,c) to be the Nica--Toeplitz algebra NT(X). We also associate to Λ and c a product system Y of C0(Λ∞)-correspondences built from infinite paths. We prove that there is an embedding of TC∗(Λ,c) into NT(Y), and an isomorphism between C∗(Λ,c) and O(Y).