To change the NPCs faction you would have to change their faction_A and faction_H in the creature_template table. How you would define what was a night elf and such would take awhile I think. For making a playable Night elf on the horde side you'd have to edit Faction.dbc to make Night elves have horde reputations and such.