In a view showing content with a node reference field, the $fields['field_node_reference']->raw (for example) returns the nid of the referring node rather than the target node.