LINQ Solution:
var rowIndexes = dgv.SelectedCells.Cast<DataGridViewCell>()
.Select(cell => cell.RowIndex)
.Distinct();
Edit:
. , DataGridViewSelectedCellCollection IEnumerable<DataGridViewCell>, IEnumerable, , , Object. :
int[] rowIndexes = (from sc in this.SelectedCells.Cast<DataGridViewCell>()
select sc.RowIndex).Distinct().ToArray();