This problem is discussed at length in T.Y. Lam's Lectures on Modules and Rings. The hyperlink should take you to the Theorem in question (5.92 in section 5G). The point is that for a commutative noetherian ring $R$ you get the result you wanted and also more:
For a commutative noetherian ring $R$ gl.dim$(R_m)=$pd$_R(R/m)$ for all maximal ideals $m$. This implies gl.dim$(R)=\sup($gl.dim$(R_m)) = \sup($pd$_R(S))$ where the last supremum runs over all simple $R$-modules.
Lam's
The proof Lam gives avoids the need to bring machinery of Extinto the picture, using instead the fact that the global dimension of a commutative noetherian local ring is the injective dimension (also the projective dimension) of its residue field.
Note that the noetherian assumption really is necessary. On page 197, Lam points out that B. Osofsky has constructed some interesting examples (he gives details) which I suspect would show this theorem fails without the noetherian hypothesis.

