City were winless and goalless in three matches going into the clash and trailed at half-time against Josep Gombau's men, who could have claimed top spot ahead of Melbourne Victory and Perth Glory had they won.
Pablo Sanchez applied a cool finish after he beat the offside trap to get on the end of Sergio Cirio's dinked pass.
But John van 't Schip's makeshift side overcame a host of absentees to claim all three points and return to the top six at the expense of reigning champions Brisbane Roar.
Safuwan Baharudin equalised seven minutes into the second half with his first for the club, Josh Kennedy headed home Robert Koren's cross and substitute Iain Ramsay made it 3-1 when he tucked away Massimo Murdocca's ball across the face of goal to seal the win.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.