Ruling coalition Barisan Nasional will win the Machap by-election in Malacca on Thursday, analysts say, but a reduced majority will signal the opposition are gaining ground.