I think jakebeal's answer is too restrictive. When I was a senior graduate student, and my PhD supervisor was a journal editor, he would occasionally ask me to do a review for his journal where it was clearly related to my work. It was clear that by this time in my graduate program that he considered me an independent researcher and thus eligible to review for his journal. His ethics and judgement on such matters were beyond question.
Just as she does when she accepts an article for publication, an editor has to make a judgement call when soliciting reviewers. Some graduate students are clearly capable of making independent evaluations of the work of others and can do so without compromising the peer review process. We wouldn't give PhDs to students if they weren't ready for that responsibility (among other things), and most graduate students are ready for it well before they actually finish writing and do their defense. All such students are eligible in my mind to do peer review.
Edited to add: It's been awhile, but I'm pretty sure I was asked to do my first journal article peer review not by my PhD supervisor, but by the first journal I submitted an article to as first author (while I was a student). I don't think my full credentials were known to the editor of that journal, but even if they were, the editor clearly thought the first author of an article was a sufficient peer to ask me to do reviewing for their journal. It's very common in my experience to be immediately asked to do a review by a journal editor upon submission of an article.