If you sublet, it is the person you signed paperwork with that has to return your deposit. He then has to turn around and settle things with the landlord. As you are suspecting, this can get pretty messy if someone refuses to pay, or if your housemate thinks he is only going to return 'your' deposit once the whole deal is settled with the landlord...
Did you pay a deposit to your housemate? Was it lodged as an 'official' deposit or was it just handed over as cash into his pocket ?