Johnston led the Dumfries club to a Second Division and Challenge Cup double in 2012/13 before going on to manage Kilmarnock and Dunfermline Athletic.
QOS face Montrose in the play-off semi-finals, with the first leg at Links Park on Tuesday, as they bid to retain their Ladbrokes Championship status.
Chairman Billy Hewitson said: "After taking the decision to relieve Gary of his duties it was vital that we moved quickly to put the new man in place. Allan is someone who knows the club and the division very well and we feel he is the ideal appointment."