When any defendant, surety in a judgment or special bail or replevin or surety in a delivery bond or replevin bond, or any person being surety in any bond whatever, has been or shall be compelled to pay any judgment or any part thereof, or shall make any payment which is applied upon such judgment by reason of such suretyship, or when any sheriff or other officer or other surety upon his or her official bond shall be compelled to pay any judgment or any part thereof by reason of any default of such officer, except for failing to pay over money collected, or for wasting property levied upon, the judgment shall not be discharged by such payment, but shall remain in force for the use of the bail, surety, officer, or other person making such payment, and after the plaintiff is paid, so much of the judgment as remains unsatisfied may be prosecuted to execution for his or her use.