There are two points telling me that you are okay to go through the recruiter.
First, you went directly to the company first and then to the recruiter, not the other way around. Most examples of unprofessional behavior in situations like this are because someone applied through a recruiter and then went around them to apply directly. This violates an agreement with the recruiter, written or non-written, and is almost always viewed negatively if the company realizes you've done it. For you there's no representation agreement to break, so there's nothing wrong.
Second, the position through the recruiter is as a contractor, not direct hire. This implies to me that your employer will actually be a separate contracting agency, not the company you have previously applied to.
As mentioned in a comment above, definitely still tell your recruiter that you have previously applied to the company, as it may be useful for them to know. But otherwise you should be fine, so good luck!