As d88mm1940 stated, the Pz IIIF started production with the 3.7cm gun. But the Pz IIIG also started production with the 3.7cm gun.
The 5cm gun was first introduced on the -G. As he has stated, after the G model started to get teh 5cm gun, F's were retrofitted. But some F's, the last units produced, were produced with the 5cm gun.
With the Pz III sub-models the ausf. designation does not necessarily indicate model improvements. For example, as BuckeyeBob has observed there should be virtually no visual difference between an -E and an -F. The -E was a contract for pre-production models, the -F was a contract for mass production models. I believe the only variance between the two was some internal engine components.
The ausf. designation essentially indicates the contract for production. As it turns out, every contract for more production included some design changes, but we see, for example in the case of the -F, that there were bigger changes WITHIN the tanks produced under that contract (upgunning to 5cm) than between this particular contract and the one before it.
Also, the -F models had not completed construction when the -G models started in production, because the old contract had not yet been completed when the new contract was let out. The key change in the -G was the armored mantlet. But it was a new contract for incremental production of tanks.
Or so I understand …
-Mark
(aka: Mk 1)