Preston punished the visitors' profligacy when Kevin Davies nodded Gallagher's free-kick across goal for defender King to head home his first goal of the season.
Scott Laird's shot on the turn was easily saved by City keeper Elliot Parish after the break before Robins captain Sam Baldock fired wide.
Both sides finished with 10 men after Osborne and Gallagher saw red after scuffling on the pitch in the closing stages.
- Sports & Recreation
- Paul Gallagher
- Karleigh Osborne
- Scott Wagstaff
- Simon Gillett