Compactness along the first branch of unstable solutions for an elliptic problem with a singular nonlinearity