The first Gilgamesh fragments were discovered in the 1850's. Did locals in the region have any cultural memory of this tale or was it completely gone to the sands of time once Islam took over?
No, it was completely forgotten. The last tablets of the Gilgamesh epic to be produced date to the 2nd or 1st century BCE. The latest known references to Gilgamesh and/or its characters prior to 1872 are the following:
None of these late references presuppose knowledge of the original Mesopotamian tale.
Source: Jeffrey H. Tigay, The Evolution of the Gilgamesh Epic, 2002, pp. 251ff
Update: The "Tale of Buluqiya", which is found in some versions of Arabian Nights, contains story motifs that might originate with the Epic of Gilgamesh.
See S. Dalley, “The Tale of Bulūqiyā and the Alexander Romance in Jewish and Sufi Mystical Circles,” in Tracing the Threads: Studies in the Vitality of Jewish Pseudepigrapha (1994), 239–69.