Hi there. This isn't an answer to your AI bug but it might me useful to you nonetheless.
Looking at your code gave me a bit of a headache so i thought I'd show you how to get it all working in an a) simplified manner and

graphical appliction.
As you can see it uses a way more friendly array to hold the data for the game instead of messy Windows User Interface bits. Using an array like this means that we use for-loops to determine a win, and draw the peices, and analyse the grid for the AI.
CODE
Option Explicit 'Always put this in. It forces you to declare your variables which is very good practice
Dim gX As Integer 'Two variables to hold the location data
Dim gY As Integer
Dim bRunning As Boolean 'if this is true then the game is on. Gets set to false to allow program exit
Dim grid(0 To 2, 0 To 2) As Byte 'This be your actual playboard. We don't need much here so we'll use bytes
'Each cell in this array will be assigned to a player id
Dim playerFinished As Boolean 'Give us a signal to set the AI going
Private Sub Form_Load()
Dim pl As Integer 'This will hold the winners id
Dim temp As Integer
Me.Show 'When using do loops, the form won't show itself unless you call this!
Do 'Start a global loop
resetgame 'reset the game board
bRunning = True 'set the game running
Do 'Start the loop
DoEvents 'ALWAYS put this statement in loops! Otherwise the app will lock up
draw 'redraw the piccybox
If playerFinished = True Then 'If player1 has finished...
playerFinished = False '...reset this switch...
AI '...and get the AI to move
End If
pl = checkwin() 'Check for a win
If pl > 0 Then bRunning = False 'If we have a winner, tell the loop to quit and move to next bit o'code
Loop While bRunning = True 'End of loop
If pl > 0 Then 'If we have a winner make a message box and handle the response
temp = MsgBox("Player " & Str$(pl) & " won!!!", vbRetryCancel)
If temp = 4 Then 'Retry pressed
pl = 0
Else
End 'Abort pressed
End If
End If
Loop
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
End 'Handles a close window request
End Sub
Private Sub Form_Resize()
Me.Height = Me.Width + 390
picVDU.Width = Me.Width - 390
picVDU.Height = Me.Height - (390 * 2)
draw
End Sub
Private Sub picVDU_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
gX = Int(x / (picVDU.ScaleWidth / 3)) 'These are normalized coordinates that point to the playing grid
gY = Int(y / (picVDU.ScaleWidth / 3)) 'They return 0 to 2
End Sub
Private Sub picVDU_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If grid(gX, gY) = 0 And Shift = 0 Then 'Test that cell is free
grid(gX, gY) = Button 'Because I haven't put the AI in for you it uses left & right mouse clicks
'Left for p1 and right for p2
playerFinished = True 'Have player1 finished
End If
If Shift = 1 Then
resetgame
End If
End Sub
Private Sub resetgame()
Dim y As Byte 'loop variables
Dim x As Byte
For y = 0 To 2
For x = 0 To 2
grid(x, y) = 0 'set all grid cells to 0
Next
Next
End Sub
Private Sub draw()
Dim td As Integer
Dim x As Byte
Dim y As Byte
picVDU.Cls 'clear the picturebox
For x = 1 To 2 'draw a grid
picVDU.Line (picVDU.ScaleLeft, (picVDU.ScaleHeight / 3) * x)-(picVDU.ScaleWidth, (picVDU.ScaleHeight / 3) * x), QBColor(15)
picVDU.Line ((picVDU.ScaleWidth / 3) * x, picVDU.ScaleTop)-((picVDU.ScaleWidth / 3) * x, picVDU.ScaleHeight), QBColor(15)
Next
td = Int(picVDU.ScaleWidth / 7) 'adapt a radius for circle drawing - also use for the x's
For y = 0 To 2
For x = 0 To 2
Select Case grid(x, y)
Case 1 'O - We draw a circle in the right location and the radius we calculated earlier
'The equations here allow us to resize the window - Cool ;)
picVDU.Circle (x * (picVDU.ScaleWidth / 3) + (picVDU.ScaleWidth / 6), y * (picVDU.ScaleHeight / 3) + (picVDU.ScaleHeight / 6)), td, QBColor(15)
Case 2 'X - We draw an X
picVDU.Line (x * (picVDU.ScaleWidth / 3) + (picVDU.ScaleWidth / 6) - td, y * (picVDU.ScaleHeight / 3) + (picVDU.ScaleHeight / 6) - td)-(x * (picVDU.ScaleWidth / 3) + (picVDU.ScaleWidth / 6) + td, y * (picVDU.ScaleHeight / 3) + (picVDU.ScaleHeight / 6) + td), QBColor(15)
picVDU.Line (x * (picVDU.ScaleWidth / 3) + (picVDU.ScaleWidth / 6) + td, y * (picVDU.ScaleHeight / 3) + (picVDU.ScaleHeight / 6) - td)-(x * (picVDU.ScaleWidth / 3) + (picVDU.ScaleWidth / 6) - td, y * (picVDU.ScaleHeight / 3) + (picVDU.ScaleHeight / 6) + td), QBColor(15)
End Select
Next
Next
End Sub
Private Function checkwin() As Integer
Dim p As Integer
Dim x As Byte
For p = 1 To 2 'loop for each player
For x = 0 To 2 'loop for each column
'this first bit tests the columns for a win
If grid(x, 0) = p And grid(x, 1) = p And grid(x, 2) = p Then
checkwin = p 'as soon as each if block detects a win it sends back the player id
Exit Function 'and exits the function
End If
'this next bit does the rows (we can reuse the "x" to save another loop)
If grid(0, x) = p And grid(1, x) = p And grid(2, x) = p Then
checkwin = p
Exit Function
End If
Next x
'Lastly check the diaganols
If grid(0, 0) = p And grid(1, 1) = p And grid(2, 2) = p Then
checkwin = p
Exit Function
End If
If grid(2, 0) = p And grid(1, 1) = p And grid(0, 2) = p Then
checkwin = p
Exit Function
End If
Next p
End Function
Private Sub AI()
'Your AI goes here
End Sub
Just put a picturebox on a form and call it picVDU and cut and paste the code into the Form code bit (delete the original stuff put in by VB).
Good luck!