In this position, Hermione takes the place of the F-Rook, Harry is on the dark-squared bishop, and Ron is on the G-Knight. Ron was in a dilemma where he had 2 conditions in order to win:
1) He must checkmate the white King
2) Harry and Hermione must survive
Moving onto the analysis, black lost the Queen but has a very strong attack on the white King (Black's light squared bishop is cutting into the King's position and even threatens a mate in 1). Ron is the real hero for making sure none of his friends get hurt while he takes the brunt of the pain.
Big credits to Jeremy Silman for composing this lovely position. Too bad the movie producers never even acknowledged him, which goes to show intellect is not respected enough these days.