We have developed a new scheme to treat a multiphase interstellar medium in smoothed particle hydrodynamics simulations of galaxy formation. This scheme can represent a co-spatial mixture of cold and hot ISM components, and is formulated without scale-dependent parameters. It is thus particularly suited to studies of cosmological structure formation where galaxies with a wide range of masses form simultaneously. We also present new algorithms for energy and heavy element injection by supernovae, and show that together these schemes can reproduce several important observed effects in galaxy evolution. Both in collapsing systems and in quiescent galaxies our codes can reproduce the Kennicutt relation between the surface densities of gas and of star formation. Strongly metal-enhanced winds are generated in both cases with ratios of mass-loss to star formation which are similar to those observed. This leads to a self-regulated cycle for star formation activity. The overall impact of feedback depends on galaxy mass. Star formation is suppressed at most by a factor of a few in massive galaxies, but in low-mass systems the effects can be much larger, giving star formation an episodic, bursty character. The larger the energy fraction assumed available in feedback, the more massive the outflows and the lower the final stellar masses. Winds from forming disks are collimated perpendicular to the disk plane, reach velocities up to 1000 km/s, and efficiently transport metals out of the galaxies. The asymptotically unbound baryon fraction drops from >95 per cent to ~30 per cent from the least to the most massive of our idealised galaxies, but the fraction of all metals ejected with this component exceeds 60 per cent regardless of mass. Such winds could plausibly enrich the intergalactic medium to observed levels.