We had a miscarriage at 12 weeks in Jan 2012. My heart hurt like hell for a few weeks before I decided I needed to find a new goal other than ttc (we'd tried for 2.5yrs before becoming pregnant). I applied to do my PhD, which I had been putting off until after babies, and it really helped my mental state to have a new project. As it turned out, I had another BFP the week before starting (now DD).
Talking through my feelings and thoughts was also very important. If you don't have friends and family who can support you, please consider counselling.