You can apply, but you will almost certainly be asked to provide extra documentation demonstrating that you are in a valid relationship, going for a valid marriage. I had to do this for my wife who was on a student visa with less than 3 months left. Wasn't really much of a problem.