Shirou wins vs Gilgamesh because of Gilgamesh's failures as a character.
Gilgamesh is too cocky about himself He has a powerful ability that can easily take down anyone, but he doesn't use it properly. Not all his fault though, since he's actually insane, so he doesn't interpret threats properly.
Shirou is his worst match up. UBW works by allowing Shirou to copy any blade or weapon he's seen. In addition to this, he gains automatic proficiency in whatever it is.
Thus, the fight will go badly for Gil. His entire vault of weaponry, once fired will bite him in the ass. Unlike normal projection, Shirou gets to project everything in an instant thanks to UBW, so just a brief glimpse is all he needs. The only weapon he's unable to copy would be Ea or the chains. The chains are only minimally useful against Shirou because of their own enchantment, but Ea can one hit Shirou.
Problem is, Gilgamesh won't use it. His pride won't allow for him to admit that he's been forced to use his trump card against a commoner, moveover a faker as he so despises.
So yes, Shirou can win against Gil under normal circumstances. He would still lose to most other servants though.