Could Barclay when he was hooked up to the Enterprise's computer in The Nth Degree have defeated the Borg? I think yes. His heightened intelligence allowed him to come up with very advanced methods. For example, he was able to increase shield strength by 300%. He was also able to generate a subspace distortion that allowed the Enterprise to travel incredibly fast. I think he would have been able to invent a defense or potent attack against the Borg. Furthermore, when he was linked with the Enterprise's computer, he was able to directly control the ship without any lag time. Like the Borg, Barclay would be able to adapt almost instantaneously to every move and react quickly.