A Liberal candidate has wrested an inner-city seat from the Greens in one of two state by-elections, as the other political contest remains too close to call.