Set active vertex through python
You can add elements to the bmesh history. The last added element is automatically set as active element. Here is a small code example:

import bpy
import bmesh

me = bpy.context.edit_object.data

#get bmesh (Object needs to be in Edit mode)
bm=bmesh.from_edit_mesh(me)

bm.select_history.add(bm.verts[5])

#print active vert:
print(bm.select_history.active)