Identification of the primary tumor site in patients with metastatic cancer is clinically important, but remains a challenge. Hence, efforts have been made towards establishing new diagnostic tools. Molecular profiling is a promising diagnostic approach, but tissue heterogeneity and inadequacy may negatively affect the accuracy and usability of molecular classifiers. We have developed and validated a microRNA-based classifier, which predicts the primary tumor site of liver biopsies, containing a limited number of tumor cells. Concurrently we explored the influence of surrounding normal tissue on classification. MicroRNA profiling was performed using quantitative Real-Time PCR on formalin-fixed paraffin-embedded samples. 278 primary tumors and liver metastases, representing nine primary tumor classes, as well as normal liver samples were used as a training set. A statistical model was applied to adjust for normal liver tissue contamination. Performance was estimated by cross-validation, followed by independent validation on 55 liver core biopsies with a tumor content as low as 10%. A microRNA classifier developed, using the statistical contamination model, showed an overall classification accuracy of 74.5% upon independent validation. Two-thirds of the samples were classified with high-confidence, with an accuracy of 92% on high-confidence predictions. A classifier trained without adjusting for liver tissue contamination, showed a classification accuracy of 38.2%. Our results indicate that surrounding normal tissue from the biopsy site may critically influence molecular classification. A significant improvement in classification accuracy was obtained when the influence of normal tissue was limited by application of a statistical contamination model.