Document everything you do. Document everything the contractor does, or better, have that person document their work, as they should anyway. Make sure you have copies of YOUR work performed. You wrote it, it's not a trade secret. You should be documenting everything you do on a daily basis or as you go anyway to help you at review time. Looking back over the year at what was done and you may only remember basic service issues but looking back througha well documented ledger proves your worth.
If the contractor answers to you, then you set their schedule and duties. If you do not have hiring/firing power, never threaten to be able to end someone's contract. If the contractor refuses to work, then discuss it with YOUR boss, not your BOSS' boss.
It could be as simple as this, "[Boss], I gave your instructions to [Contractor] and he is refusing to perform the work."
You do not have to offer any additional information unless asked. Anything you offer can be seen as your emotional response to a 'contractor' infringing on your turf. DO NOT offer suggestions of discipline! Remember, you're not a manager. It's not your job. You report that the work is not getting done, since it does affect your work directly. Someone has to do it. That is all you have to do.
If you send your boss this as an email and he responds in email and it is not favorable to you, this is evidence in case you're terminated. Employers and person's in managerial positions have certain guidelines they have to live by. They have to be fair to everyone.
If you talk to your boss in person, do not get emotional and have what you want to say already written down or at least highlights. In fact, it's good to have it in writing showing what was expected and what was received.
If the contractor doesn't answer to you, don't worry about it. Do what is expected of you and move on.
They could be out to get you but hiring a contractor in lieu of an employee is not proof although they could be testing their skills against yours to see if the grass is greener. Contractors are expenses. They are not employees. They do not get benefits. You do not have to pay unemployment for them, etc. They come out of another budget. That could be a reason. Even if you know it's not, to a 3rd party, like an arbitrator or a judge/jury, it will sound reasonable. If they let you go, for no reason, you can always file wrongful dismissal but don't threaten them with it. It will not get you your job back and you most likely won't want it should you lose it but it may make unemployment a little easier to live with while looking for work. If they let you go, you're not going to have a reference anyway. Also, giving them the "head's up" affords them the chance to get it right, which is bad for you.
What does work in your favor, for which I have used successfully in contract disputes, not for employment unfortunately, is a voice-activated tape recorder. Be sure in the state where you live that recording you and someone else only requires one person to be aware, as it does in my state. And, get as much as you can in writing and make sure you have a copy of the Employee Handbook (updated) offsite. Also, make sure this is not restricted in the Employee Handbook. Here is another thing... You are bound to any agreement you have signed which does not violate any state/federal laws. You are not bound to anything you did not sign even if there is a policy stating it is forbidden. The law says they have to make it avaiable to you and proof you have read and agreed to it. They use your signature as proof. You also should have a copy of any documents you have signed. You have a right to them by law. You're generally given a copy when you sign them.
If you're let go, you could be walked to the door and told to gather your things tomorrow or some time later. An employee handbook will not be something that you can show a need for once you're terminated without drawing suspicion. Even if you're allowed to gather your things before leaving, most likely you will be monitored, as you should be.
It is a shame that steps like these need to be taken sometimes but then corruption is everywhere and the best defense is a good offense. They can write you up for being late and let you go the next time you're late. They can give you too many tasks at once and they say you don't get your work done. Wrongful dismissal is hard to prove unless you have evidence.
Your best bet, if you're concerned with what might happen is to start looking for something else. It's a lot better to avoid the situation, if at all possible. Yes, it sux that you have to do the right thing but in Business Law 101, it says, "When the law finds both parties engaged in illegal activities, the law leaves them where they found them." This means the law looks at both of you as being in the wrong. Also, you might want to consult an attorney that specializes in HR issues. I only offer information "as is" without any warranties expressed or implied. I am not an attorney and cannot legally advise you to do anything. My comments are merely suggestions and you take responsibilties for your own actions.
What you have is people not being responsible and professional. It also shows prejudice if there are actually policies and procedures for porn on company computers. Firing the 'whistle-blower' is not as easy to get away with as it used to be.
What your buddy should have done was report it to his boss. The department manager, be that a manager, director, CTO, CIO, whatever should then report it to HR. You should never go over the chain of command unless your supervisor is the problem. People forget that managers are supposed to manage people, first. You hire specialists, such as yourself, to get the work done. The manager makes sure you do and is the link between you and the other departments, via their managers. Corruption at the management level and above can cause serious issues. When it's at the upper management level, it's even worse.
Been there, done that!
Good luck!