As far as I can tell your case is already mentioned in the gnuplot manual about fit:
As an example, if one has 2 independent variables, and errors for the first independent variable and the
dependent variable, one uses the errors x,z qualifier, and a using qualifier with 5 columns, which are
interpreted as x:y:z:sx:sz (where x and y are the independent variables, z the dependent variable, and sx and
sz the standard deviations of x and z).
x ("x" in your data file) and y (line number) are your two independent variables, z ("y" in your data file) is the dependent variable. For your case the fit command should look like
fit f(x,y) 'files.dat' using 1:-1:2:3:4 errors x,z via a,b,c