When the Medes and the Babylonians conquered Nineveh in 612 B.C. they also destroyed the "Library of Ashurbanipal". Clay tablets from that library mainly "survived" as fragments. These South-West Palace, which contained the library, wasn't rediscovered until around 1850. This is where the most complete surviving versions of the Gilgamesh Epic were later found.
This does not mean that the epic did not circulate between 612 B.C. and the 1850s. The most recent fragment in cuneiform dates from around 130 B.C. (and the most recent cuneiform text from Ancient Babylonia was dated around 75 AD). However, according to Walther Sallaberger, the Gilgamesh Epic ceased to be part of a scribe's general education during the first millennium B.C. (See Sallaberger: Das Gilgamesch-Epos. Mythos, Werk und Tradition C. H. Beck, 2008.)
The most reliable historian of Babylonia from Antiquity was the Chaldean priest Berossus or Berosus, who wrote his Babyloniaca around 290 B.C. This work has survived only in fragmentary quotations by other authors. One of these was Aelian (or Claudius Aelianus), a Roman author who wrote in Greek and mentioned a Babylonian king named Gilgamos. However, his Gilgamos story has nothing to do with what we know from the epic. The flood story in Berossus's Babyloniaca is very similar to the one from the Gilgamesh epic but with a different protagonist: Xisothros (the Sumerian Ziusudra) instead of Utnapishtim.
The name Gilgamesh, disconnected from the epic, seems to have survived in the Dead Sea Scrolls from Qumran, where glgmyš/s meant "menacing giant". The name Humbabah seems to have survived as Hôbabiš, which also meant "giant". These two names lived on in Manichean literature until the early Middle Ages.
Even though the Babylonian flood story probably predates the Biblical version, people in the late nineteenth-century had great difficulty to accept that this might actually be the case. The flood story known in the West for roughly two millennia was definitely not seen as a Babylonian story for two reasons: (1) the Biblical flood is caused by God and the Bible was seen as the word of God, so any alternative narrative must necessarily be wrong, and (2) the West knew almost nothing about Babylonia from sources other than the Bible (and those other sources were less authoritative for the reason already mentioned).
Using the flood story in the Bible as an argument for the survival of knowledge about the Epic of Gilgamesh has a serious flaw: the flood story is just part of Tablet XI of the epic and does not involve Gilgamesh himself. Knowledge about other parts of the epic evidently did not survive, e.g. how Enkidu came into being, how he became Gilgamesh's servant (in the Sumerian stories) or friend (in the Standard Babylonian version), how both men went to the Cedar Forest, how they fought the Bull of Heaven, how Enkidu died and, rather importantly, how Gilgamesh's quest for immortality. A Gilgamesh epic without the flood story would still be an epic. A flood story without Gilgamesh is just a myth shared by several cultures.
Assyriologists today consider the Epic of Gilgamesh as a story that was rediscovered rather than one that has a continuous cultural history.