In inverting amplifiers, isn't the virtual earth approximation only valid for extremely high gains?
I think you are confusing the open loop gain of the op-amp itself (i.e. the gain if there is no feedback resistor), with the gain of the inverting op-amp circuit.

With no feedback the output is
$$V_o = G_o(V_+ - V_-)\,,$$
where $G_o$ is the open loop gain. For an ideal op-amp \$G_o\$ is infinity, for a real one it is very high (\$\sim 10^5)\$.

Now if we want to build an amplifier which doesn't have a gain of \$10^5\$ we put a feedback resistor in from the output to the negative terminal, this feedback resistor acts to balance the two inputs. In the circuit above the positive terminal is ground so as \$G_o \rightarrow \infty\$, \$A\rightarrow\$ ground. Now this circuit (not the op-amp itself) has a gain of 
$$G = -\frac{R_2}{R_1}\,.$$
Where the circuit gain is defined as
$$G = \frac{V_\mathrm{out}}{V_\mathrm{in}}\,.
$$